Skip to content

Commit

Permalink
test-process-util: skip several verifications when running in unprivi…
Browse files Browse the repository at this point in the history
…leged container
  • Loading branch information
yuwata committed Sep 20, 2018
1 parent 9590065 commit 767eab4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/test/test-process-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,17 @@ static void test_rename_process_now(const char *p, int ret) {
log_info("comm = <%s>", comm);
assert_se(strneq(comm, p, TASK_COMM_LEN-1));

assert_se(get_process_cmdline(0, 0, false, &cmdline) >= 0);
r = get_process_cmdline(0, 0, false, &cmdline);
assert_se(r >= 0);
/* we cannot expect cmdline to be renamed properly without privileges */
if (geteuid() == 0) {
log_info("cmdline = <%s>", cmdline);
assert_se(strneq(p, cmdline, STRLEN("test-process-util")));
assert_se(startswith(p, cmdline));
if (r == 0 && detect_container() > 0)
log_info("cmdline = <%s> (not verified, Running in unprivileged container?)", cmdline);
else {
log_info("cmdline = <%s>", cmdline);
assert_se(strneq(p, cmdline, STRLEN("test-process-util")));
assert_se(startswith(p, cmdline));
}
} else
log_info("cmdline = <%s> (not verified)", cmdline);
}
Expand Down

0 comments on commit 767eab4

Please sign in to comment.