]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-execute: check if nobody exists before running some tests 1703/head
authorRonny Chevalier <chevalier.ronny@gmail.com>
Wed, 28 Oct 2015 10:30:40 +0000 (11:30 +0100)
committerRonny Chevalier <chevalier.ronny@gmail.com>
Wed, 28 Oct 2015 10:51:37 +0000 (11:51 +0100)
src/test/test-execute.c

index cdbfe6698e00440d6ffb50d6fa28c4548165b17b..dcd298d571e3a06d6f2008c9a131a48e23c962db 100644 (file)
@@ -18,6 +18,9 @@
 ***/
 
 #include <stdio.h>
+#include <sys/types.h>
+#include <grp.h>
+#include <pwd.h>
 
 #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[]) {