From: Ronny Chevalier Date: Wed, 28 Oct 2015 10:30:40 +0000 (+0100) Subject: test-execute: check if nobody exists before running some tests X-Git-Tag: v228~135^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1703%2Fhead;p=thirdparty%2Fsystemd.git test-execute: check if nobody exists before running some tests --- diff --git a/src/test/test-execute.c b/src/test/test-execute.c index cdbfe6698e0..dcd298d571e 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -18,6 +18,9 @@ ***/ #include +#include +#include +#include #include "fs-util.h" #include "macro.h" @@ -124,11 +127,13 @@ static void test_exec_systemcallerrornumber(Manager *m) { } static void test_exec_user(Manager *m) { - test(m, "exec-user.service", 0, CLD_EXITED); + if (getpwnam("nobody")) + test(m, "exec-user.service", 0, CLD_EXITED); } static void test_exec_group(Manager *m) { - test(m, "exec-group.service", 0, CLD_EXITED); + if (getgrnam("nobody")) + test(m, "exec-group.service", 0, CLD_EXITED); } static void test_exec_environment(Manager *m) { @@ -145,7 +150,8 @@ static void test_exec_umask(Manager *m) { static void test_exec_runtimedirectory(Manager *m) { test(m, "exec-runtimedirectory.service", 0, CLD_EXITED); test(m, "exec-runtimedirectory-mode.service", 0, CLD_EXITED); - test(m, "exec-runtimedirectory-owner.service", 0, CLD_EXITED); + if (getgrnam("nobody")) + test(m, "exec-runtimedirectory-owner.service", 0, CLD_EXITED); } int main(int argc, char *argv[]) {