diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-01-18 20:07:51 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-01-18 20:07:51 +0100 |
commit | 607ff5f95aac387ef3fb79358e7416b7c8b2090d (patch) | |
tree | 1d78d316b1d8906c051a95ad432307309bd309d1 /src/test/test-execute.c | |
parent | 21fce57b26f50381d21a22be4d62a8f6067dc5c9 (diff) |
Revert "test-exec: do not skip all the tests"
This reverts commit 68e68ca8106e7cd874682ae425843b48579c6539. We *need*
root access to create cgroups. The only exception is if it is run from
within a cgroup with "Delegate=yes". However, this is not always true and
we really shouldn't rely on this.
If your terminal runs from within a systemd --user instance, you're fine.
Everyone else is not (like running from ssh, VTs, and so on..).
Diffstat (limited to 'src/test/test-execute.c')
-rw-r--r-- | src/test/test-execute.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 69368b177b..91ccaf72b8 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -90,10 +90,6 @@ static void test_exec_ignoresigpipe(Manager *m) { } static void test_exec_privatetmp(Manager *m) { - if (getuid() != 0) { - printf("Skipping test_exec_privatetmp: not root\n"); - return; - } assert_se(touch("/tmp/test-exec_privatetmp") >= 0); test(m, "exec-privatetmp-yes.service", 0, CLD_EXITED); @@ -103,10 +99,6 @@ static void test_exec_privatetmp(Manager *m) { } static void test_exec_privatedevices(Manager *m) { - if (getuid() != 0) { - printf("Skipping test_exec_privatedevices: not root\n"); - return; - } test(m, "exec-privatedevices-yes.service", 0, CLD_EXITED); test(m, "exec-privatedevices-no.service", 0, CLD_EXITED); } @@ -127,18 +119,10 @@ static void test_exec_systemcallerrornumber(Manager *m) { } static void test_exec_user(Manager *m) { - if (getuid() != 0) { - printf("Skipping test_exec_user: not root\n"); - return; - } test(m, "exec-user.service", 0, CLD_EXITED); } static void test_exec_group(Manager *m) { - if (getuid() != 0) { - printf("Skipping test_exec_group: not root\n"); - return; - } test(m, "exec-group.service", 0, CLD_EXITED); } @@ -149,10 +133,6 @@ static void test_exec_environment(Manager *m) { } static void test_exec_umask(Manager *m) { - if (getuid() != 0) { - printf("Skipping test_exec_umask: not root\n"); - return; - } test(m, "exec-umask-default.service", 0, CLD_EXITED); test(m, "exec-umask-0177.service", 0, CLD_EXITED); } @@ -179,6 +159,12 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); + /* It is needed otherwise cgroup creation fails */ + if (getuid() != 0) { + printf("Skipping test: not root\n"); + return EXIT_TEST_SKIP; + } + assert_se(set_unit_path(TEST_DIR ":") >= 0); r = manager_new(SYSTEMD_USER, true, &m); |