This test requires root, but the check was mistakenly dropped, causing it
to fail with an assert when running without root:
src/test/test-bpf-foreign-programs.c:308: Assertion failed: expected "test_bpf_cgroup_programs(m, "single_prog.service", single_prog, ELEMENTSOF(single_prog))" to succeed, but got error: Operation not permitted
Restore the uid check
Follow-up for
22e2f0642897cfa7ba975527f5394bd7fcdf639b
if (detect_container() > 0)
return log_tests_skipped("test-bpf fails inside LXC and Docker containers: https://github.com/systemd/systemd/issues/9666");
+ if (getuid() != 0)
+ return log_tests_skipped("not running as root");
+
r = bpf_program_supported();
if (r < 0)
- return log_tests_skipped_errno(r, "not running as root");
+ return log_tests_skipped_errno(r, "BPF programs not supported");
ASSERT_OK(getrlimit(RLIMIT_MEMLOCK, &rl));
rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, CAN_MEMLOCK_SIZE);