1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <test_progs.h> 4 #include "test_helper_restricted.skel.h" 5 6 void test_helper_restricted(void) 7 { 8 int prog_i = 0, prog_cnt; 9 int duration = 0; 10 11 do { 12 struct test_helper_restricted *test; 13 int maybeOK; 14 15 test = test_helper_restricted__open(); 16 if (!ASSERT_OK_PTR(test, "open")) 17 return; 18 19 prog_cnt = test->skeleton->prog_cnt; 20 21 for (int j = 0; j < prog_cnt; ++j) { 22 struct bpf_program *prog = *test->skeleton->progs[j].prog; 23 24 maybeOK = bpf_program__set_autoload(prog, prog_i == j); 25 ASSERT_OK(maybeOK, "set autoload"); 26 } 27 28 maybeOK = test_helper_restricted__load(test); 29 CHECK(!maybeOK, test->skeleton->progs[prog_i].name, "helper isn't restricted"); 30 31 test_helper_restricted__destroy(test); 32 } while (++prog_i < prog_cnt); 33 } 34