mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
test: fix root check for test-bpf-foreign-programs
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 22e2f06428
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
d7b217f2a9
commit
f0b7ca9768
@@ -279,9 +279,12 @@ int main(int argc, char *argv[]) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user