diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 2bff00a9f7..fba798e22b 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 750f5c0379..5c533f4833 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 0000000000..cf0773229e --- /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