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