This source file includes following definitions.
- test_reference_tracking
1
2 #include <test_progs.h>
3
4 void test_reference_tracking(void)
5 {
6 const char *file = "./test_sk_lookup_kern.o";
7 struct bpf_object *obj;
8 struct bpf_program *prog;
9 __u32 duration = 0;
10 int err = 0;
11
12 obj = bpf_object__open(file);
13 if (CHECK_FAIL(IS_ERR(obj)))
14 return;
15
16 bpf_object__for_each_program(prog, obj) {
17 const char *title;
18
19
20 title = bpf_program__title(prog, false);
21 if (strstr(title, ".text") != NULL)
22 continue;
23
24 bpf_program__set_type(prog, BPF_PROG_TYPE_SCHED_CLS);
25
26
27 if (strstr(title, "fail") != NULL) {
28 libbpf_print_fn_t old_print_fn;
29
30 old_print_fn = libbpf_set_print(NULL);
31 err = !bpf_program__load(prog, "GPL", 0);
32 libbpf_set_print(old_print_fn);
33 } else {
34 err = bpf_program__load(prog, "GPL", 0);
35 }
36 CHECK(err, title, "\n");
37 }
38 bpf_object__close(obj);
39 }