mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
test: add test cases for RuntimeDirectoryPreserve=yes
This commit is contained in:
parent
05d418fed9
commit
e4c01fe6af
@ -595,6 +595,10 @@ static void test_exec_dynamicuser(Manager *m) {
|
||||
(void) rm_rf("/var/lib/test-dynamicuser-migrate2", REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
(void) rm_rf("/var/lib/private/test-dynamicuser-migrate", REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
(void) rm_rf("/var/lib/private/test-dynamicuser-migrate2", REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
|
||||
test(__func__, m, "exec-dynamicuser-runtimedirectory1.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED);
|
||||
test(__func__, m, "exec-dynamicuser-runtimedirectory2.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED);
|
||||
test(__func__, m, "exec-dynamicuser-runtimedirectory3.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED);
|
||||
}
|
||||
|
||||
static void test_exec_environment(Manager *m) {
|
||||
|
11
test/test-execute/exec-dynamicuser-runtimedirectory1.service
Normal file
11
test/test-execute/exec-dynamicuser-runtimedirectory1.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Test for RuntimeDirectory with RuntimeDirectoryPreserve=yes and DynamicUser=yes
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
|
||||
ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
|
||||
ExecStart=/bin/sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
|
||||
Type=oneshot
|
||||
RuntimeDirectory=test-exec_runtimedirectorypreserve
|
||||
RuntimeDirectoryPreserve=yes
|
||||
DynamicUser=yes
|
12
test/test-execute/exec-dynamicuser-runtimedirectory2.service
Normal file
12
test/test-execute/exec-dynamicuser-runtimedirectory2.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Test for RuntimeDirectory with RuntimeDirectoryPreserve=yes and DynamicUser=yes 2nd trial
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
|
||||
ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
|
||||
ExecStart=/bin/sh -x -c 'test -f $$RUNTIME_DIRECTORY/test'
|
||||
ExecStart=/bin/sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
|
||||
Type=oneshot
|
||||
RuntimeDirectory=test-exec_runtimedirectorypreserve
|
||||
RuntimeDirectoryPreserve=yes
|
||||
DynamicUser=yes
|
11
test/test-execute/exec-dynamicuser-runtimedirectory3.service
Normal file
11
test/test-execute/exec-dynamicuser-runtimedirectory3.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Test for RuntimeDirectory with DynamicUser=yes migrated from RuntimeDirectoryPreserve=yes
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
|
||||
ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
|
||||
ExecStart=/bin/sh -x -c 'test -f $$RUNTIME_DIRECTORY/test'
|
||||
ExecStart=/bin/sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
|
||||
Type=oneshot
|
||||
RuntimeDirectory=test-exec_runtimedirectorypreserve
|
||||
DynamicUser=yes
|
Loading…
Reference in New Issue
Block a user