diff options
author | Ronny Chevalier <chevalier.ronny@gmail.com> | 2015-09-21 15:36:07 +0200 |
---|---|---|
committer | Ronny Chevalier <chevalier.ronny@gmail.com> | 2015-09-21 18:14:44 +0200 |
commit | cc3ddc851fbe5adf9dfc7e4a702a8b5b6a1186d6 (patch) | |
tree | 9f6301af25271b46a7f05cdb7199239e4f71ae66 | |
parent | 35bb18851a2b07d2b7ca65c6722012cdc3399a32 (diff) |
test-execute: add tests for RuntimeDirectory
-rw-r--r-- | src/test/test-execute.c | 7 | ||||
-rw-r--r-- | test/exec-runtimedirectory-mode.service | 8 | ||||
-rw-r--r-- | test/exec-runtimedirectory.service | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 0f4172e722..60540f8d28 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -137,6 +137,11 @@ static void test_exec_umask(Manager *m) { test(m, "exec-umask-0177.service", 0, CLD_EXITED); } +static void test_exec_runtimedirectory(Manager *m) { + test(m, "exec-runtimedirectory.service", 0, CLD_EXITED); + test(m, "exec-runtimedirectory-mode.service", 0, CLD_EXITED); +} + int main(int argc, char *argv[]) { test_function_t tests[] = { test_exec_workingdirectory, @@ -150,6 +155,7 @@ int main(int argc, char *argv[]) { test_exec_group, test_exec_environment, test_exec_umask, + test_exec_runtimedirectory, NULL, }; test_function_t *test = NULL; @@ -165,6 +171,7 @@ int main(int argc, char *argv[]) { return EXIT_TEST_SKIP; } + assert_se(setenv("XDG_RUNTIME_DIR", "/tmp/", 1) == 0); assert_se(set_unit_path(TEST_DIR) >= 0); r = manager_new(MANAGER_USER, true, &m); diff --git a/test/exec-runtimedirectory-mode.service b/test/exec-runtimedirectory-mode.service new file mode 100644 index 0000000000..ba6d7ee39f --- /dev/null +++ b/test/exec-runtimedirectory-mode.service @@ -0,0 +1,8 @@ +[Unit] +Description=Test for RuntimeDirectoryMode + +[Service] +ExecStart=/bin/sh -c 's=$(stat -c %a /tmp/test-exec_runtimedirectory-mode); echo $s; exit $(test $s = "750")' +Type=oneshot +RuntimeDirectory=test-exec_runtimedirectory-mode +RuntimeDirectoryMode=0750 diff --git a/test/exec-runtimedirectory.service b/test/exec-runtimedirectory.service new file mode 100644 index 0000000000..c12a6c63d6 --- /dev/null +++ b/test/exec-runtimedirectory.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for RuntimeDirectory + +[Service] +ExecStart=/bin/sh -c 'exit $(test -d /tmp/test-exec_runtimedirectory)' +Type=oneshot +RuntimeDirectory=test-exec_runtimedirectory |