mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
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.
This commit is contained in:
parent
05fd2156b7
commit
66d73cc728
@ -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) {
|
||||
|
@ -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
|
||||
|
7
test/test-execute/exec-group-nogroup.service
Normal file
7
test/test-execute/exec-group-nogroup.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Test for Group
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -x -c 'test "$$(id -n -g)" = "nogroup"'
|
||||
Type=oneshot
|
||||
Group=nogroup
|
Loading…
Reference in New Issue
Block a user