From: Lennart Poettering Date: Tue, 5 Dec 2017 09:59:44 +0000 (+0100) Subject: test-execute: use the "nogroup" group if it exists for testing X-Git-Tag: v236~56^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=66d73cc7284b7a9b2c54d2cc1977d0c28237a20c;p=thirdparty%2Fsystemd.git test-execute: use the "nogroup" group if it exists for testing We currently look for "nobody" and "nfsnobody" when testing groups, both of which do not exist on Ubuntu, our main testing environment. Let's extend the tests slightly to also use "nogroup" if it exists. --- diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 2bff00a9f7f..fba798e22b0 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -324,7 +324,6 @@ static void test_exec_systemcallfilter_system(Manager *m) { log_notice("Seccomp not available, skipping %s", __func__); return; } - if (getpwnam("nobody")) test(m, "exec-systemcallfilter-system-user.service", 0, CLD_EXITED); else if (getpwnam("nfsnobody")) @@ -348,8 +347,10 @@ static void test_exec_group(Manager *m) { test(m, "exec-group.service", 0, CLD_EXITED); else if (getgrnam("nfsnobody")) test(m, "exec-group-nfsnobody.service", 0, CLD_EXITED); + else if (getgrnam("nogroup")) + test(m, "exec-group-nogroup.service", 0, CLD_EXITED); else - log_error_errno(errno, "Skipping %s, could not find nobody/nfsnobody group: %m", __func__); + log_error_errno(errno, "Skipping %s, could not find nobody/nfsnobody/nogroup group: %m", __func__); } static void test_exec_supplementarygroups(Manager *m) { diff --git a/test/meson.build b/test/meson.build index 750f5c03796..5c533f4833a 100644 --- a/test/meson.build +++ b/test/meson.build @@ -68,6 +68,7 @@ test_data_files = ''' test-execute/exec-environment.service test-execute/exec-environmentfile.service test-execute/exec-group-nfsnobody.service + test-execute/exec-group-nogroup.service test-execute/exec-group.service test-execute/exec-ignoresigpipe-no.service test-execute/exec-ignoresigpipe-yes.service diff --git a/test/test-execute/exec-group-nogroup.service b/test/test-execute/exec-group-nogroup.service new file mode 100644 index 00000000000..cf0773229e2 --- /dev/null +++ b/test/test-execute/exec-group-nogroup.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for Group + +[Service] +ExecStart=/bin/sh -x -c 'test "$$(id -n -g)" = "nogroup"' +Type=oneshot +Group=nogroup