diff options
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index a08d026ac396..c52bd90fbb34 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <string.h> | 10 | #include <string.h> |
11 | #include <assert.h> | 11 | #include <assert.h> |
12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
13 | #include <stdarg.h> | ||
13 | #include <time.h> | 14 | #include <time.h> |
14 | 15 | ||
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
@@ -1783,6 +1784,15 @@ static void test_task_fd_query_tp(void) | |||
1783 | "sys_enter_read"); | 1784 | "sys_enter_read"); |
1784 | } | 1785 | } |
1785 | 1786 | ||
1787 | static int libbpf_debug_print(enum libbpf_print_level level, | ||
1788 | const char *format, va_list args) | ||
1789 | { | ||
1790 | if (level == LIBBPF_DEBUG) | ||
1791 | return 0; | ||
1792 | |||
1793 | return vfprintf(stderr, format, args); | ||
1794 | } | ||
1795 | |||
1786 | static void test_reference_tracking() | 1796 | static void test_reference_tracking() |
1787 | { | 1797 | { |
1788 | const char *file = "./test_sk_lookup_kern.o"; | 1798 | const char *file = "./test_sk_lookup_kern.o"; |
@@ -1809,9 +1819,9 @@ static void test_reference_tracking() | |||
1809 | 1819 | ||
1810 | /* Expect verifier failure if test name has 'fail' */ | 1820 | /* Expect verifier failure if test name has 'fail' */ |
1811 | if (strstr(title, "fail") != NULL) { | 1821 | if (strstr(title, "fail") != NULL) { |
1812 | libbpf_set_print(NULL, NULL, NULL); | 1822 | libbpf_set_print(NULL); |
1813 | err = !bpf_program__load(prog, "GPL", 0); | 1823 | err = !bpf_program__load(prog, "GPL", 0); |
1814 | libbpf_set_print(printf, printf, NULL); | 1824 | libbpf_set_print(libbpf_debug_print); |
1815 | } else { | 1825 | } else { |
1816 | err = bpf_program__load(prog, "GPL", 0); | 1826 | err = bpf_program__load(prog, "GPL", 0); |
1817 | } | 1827 | } |