summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-10-12 13:25:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2017-10-12 13:25:06 +0900
commitd053b72bdd6bb1421cc33ff190545371a9e34cca (patch)
tree4767e23226043a55e83a61b16d3347049980c034 /test
parent35d379b2e8b92388a73f245e5cfcaa7e7371e8a7 (diff)
downloadsystemd-d053b72bdd6bb1421cc33ff190545371a9e34cca.tar.gz
systemd-d053b72bdd6bb1421cc33ff190545371a9e34cca.tar.bz2
systemd-d053b72bdd6bb1421cc33ff190545371a9e34cca.zip
test: add test for BindPaths= and BindReadOnlyPaths=
Follow-up for a8cabc612b16834260831a8163ae4b479b5c33a5.
Diffstat (limited to 'test')
-rw-r--r--test/meson.build1
-rw-r--r--test/test-execute/exec-bind-paths.service14
2 files changed, 15 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
index c2df7ec226..2b523da725 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -46,6 +46,7 @@ test_data_files = '''
test-path/path-makedirectory.path
test-path/path-modified.path
test-path/path-unit.path
+ test-execute/exec-bind-paths.service
test-execute/exec-environment-empty.service
test-execute/exec-environment-multiple.service
test-execute/exec-environment.service
diff --git a/test/test-execute/exec-bind-paths.service b/test/test-execute/exec-bind-paths.service
new file mode 100644
index 0000000000..e6584c8ef4
--- /dev/null
+++ b/test/test-execute/exec-bind-paths.service
@@ -0,0 +1,14 @@
+[Service]
+Type=oneshot
+# Create a file in /tmp/test-exec_bind_paths
+ExecStart=/bin/sh -c 'touch /tmp/test-exec_bind_paths/thisisasimpletest'
+# Then, the file can be access through /tmp
+ExecStart=/bin/sh -c 'test -f /tmp/thisisasimpletest'
+# Also, through /tmp/test-exec_bind_readonly_paths
+ExecStart=/bin/sh -c 'test -f /tmp/test-exec_bind_readonly_paths/thisisasimpletest'
+# The file cannot modify through /tmp/test-exec_bind_readonly_paths
+ExecStart=/bin/sh -x -c '! touch /tmp/test-exec_bind_readonly_paths/thisisasimpletest'
+# Cleanup
+ExecStart=/bin/sh -c 'rm /tmp/thisisasimpletest'
+BindPaths=/tmp:/tmp/test-exec_bind_paths
+BindReadOnlyPaths=/tmp:/tmp/test-exec_bind_readonly_paths