1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
3 #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)
10 if (!strstr(format, "verifier log"))
12 return vfprintf(stderr, "%s", args);
15 static int check_load(const char *file)
17 struct bpf_prog_load_attr attr;
18 struct bpf_object *obj = NULL;
21 memset(&attr, 0, sizeof(struct bpf_prog_load_attr));
23 attr.prog_type = BPF_PROG_TYPE_SCHED_CLS;
25 err = bpf_prog_load_xattr(&attr, &obj, &prog_fd);
26 bpf_object__close(obj);
32 void test_bpf_verif_scale(void)
34 const char *file1 = "./test_verif_scale1.o";
35 const char *file2 = "./test_verif_scale2.o";
36 const char *file3 = "./test_verif_scale3.o";
40 libbpf_set_print(libbpf_debug_print);
42 err = check_load(file1);
43 err |= check_load(file2);
44 err |= check_load(file3);
46 printf("test_verif_scale:OK\n");
48 printf("test_verif_scale:FAIL\n");