summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2015-10-28 11:30:40 +0100
committerRonny Chevalier <chevalier.ronny@gmail.com>2015-10-28 11:51:37 +0100
commitcc7fa4fb4a64682f36f07db9c286ec3fb0477a65 (patch)
tree17513ade90e31a272ed6740901abff73098ac311 /src
parentdf5b3e1840a373dca1e3da5b81540b7862994ab4 (diff)
test-execute: check if nobody exists before running some tests
Diffstat (limited to 'src')
-rw-r--r--src/test/test-execute.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index cdbfe6698e..dcd298d571 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -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[]) {