test: add test for BindPaths= and BindReadOnlyPaths=

Follow-up for a8cabc612b.
This commit is contained in:
Yu Watanabe
2017-10-12 13:25:06 +09:00
parent 35d379b2e8
commit d053b72bdd
3 changed files with 26 additions and 0 deletions
+1
View File
@@ -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
+14
View File
@@ -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