tests: drop pointless checks for root
Testing the error paths is very important. If we are not root, we should try and get a failure, which we should report nicely and mark the test as skipped. After those checks are removed, this is what seems to happen. This way we can see what will happen e.g. in the user manager when we try to perform some bpf ops.
This commit is contained in:
@@ -61,9 +61,6 @@ int main(int argc, char *argv[]) {
|
||||
r = bpf_program_add_instructions(p, exit_insn, ELEMENTSOF(exit_insn));
|
||||
assert_se(r == 0);
|
||||
|
||||
if (getuid() != 0)
|
||||
return log_tests_skipped("not running as root");
|
||||
|
||||
r = bpf_firewall_supported();
|
||||
if (r == BPF_FIREWALL_UNSUPPORTED)
|
||||
return log_tests_skipped("BPF firewalling not supported");
|
||||
|
||||
@@ -68,9 +68,6 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
if (getuid() != 0)
|
||||
return log_tests_skipped("not running as root");
|
||||
|
||||
assert_se(getrlimit(RLIMIT_MEMLOCK, &rl) >= 0);
|
||||
rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, CAN_MEMLOCK_SIZE);
|
||||
(void) setrlimit_closest(RLIMIT_MEMLOCK, &rl);
|
||||
|
||||
@@ -110,9 +110,6 @@ 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");
|
||||
|
||||
assert_se(getrlimit(RLIMIT_MEMLOCK, &rl) >= 0);
|
||||
rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, CAN_MEMLOCK_SIZE);
|
||||
(void) setrlimit_closest(RLIMIT_MEMLOCK, &rl);
|
||||
|
||||
Reference in New Issue
Block a user