staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / prog_tests / reference_tracking.c
blob5633be43828fc59d3ba35b97de711f0e1bb30bdd
1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
4 static int libbpf_debug_print(enum libbpf_print_level level,
5 const char *format, va_list args)
7 if (level == LIBBPF_DEBUG)
8 return 0;
10 return vfprintf(stderr, format, args);
13 void test_reference_tracking(void)
15 const char *file = "./test_sk_lookup_kern.o";
16 struct bpf_object *obj;
17 struct bpf_program *prog;
18 __u32 duration = 0;
19 int err = 0;
21 obj = bpf_object__open(file);
22 if (IS_ERR(obj)) {
23 error_cnt++;
24 return;
27 bpf_object__for_each_program(prog, obj) {
28 const char *title;
30 /* Ignore .text sections */
31 title = bpf_program__title(prog, false);
32 if (strstr(title, ".text") != NULL)
33 continue;
35 bpf_program__set_type(prog, BPF_PROG_TYPE_SCHED_CLS);
37 /* Expect verifier failure if test name has 'fail' */
38 if (strstr(title, "fail") != NULL) {
39 libbpf_set_print(NULL);
40 err = !bpf_program__load(prog, "GPL", 0);
41 libbpf_set_print(libbpf_debug_print);
42 } else {
43 err = bpf_program__load(prog, "GPL", 0);
45 CHECK(err, title, "\n");
47 bpf_object__close(obj);