Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Do not export subtest as standalone test

Two subtests in ksyms_module.c are not qualified as static, so these
subtests are exported as standalone tests in tests.h and lead to
confusion for the output of "./test_progs -t ksyms_module".

By using the following command ...

grep "^void \(serial_\)\?test_[a-zA-Z0-9_]\+(\(void\)\?)" \
tools/testing/selftests/bpf/prog_tests/*.c | \
awk -F : '{print $1}' | sort | uniq -c | awk '$1 != 1'

... one finds out that other tests also have a similar problem, so
fix these tests by marking subtests in these tests as static.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220208065444.648778-1-houtao1@huawei.com

authored by

Hou Tao and committed by
Daniel Borkmann
5912fcb4 f95f768f

+8 -8
+2 -2
tools/testing/selftests/bpf/prog_tests/ksyms_module.c
··· 6 6 #include "test_ksyms_module.lskel.h" 7 7 #include "test_ksyms_module.skel.h" 8 8 9 - void test_ksyms_module_lskel(void) 9 + static void test_ksyms_module_lskel(void) 10 10 { 11 11 struct test_ksyms_module_lskel *skel; 12 12 int err; ··· 33 33 test_ksyms_module_lskel__destroy(skel); 34 34 } 35 35 36 - void test_ksyms_module_libbpf(void) 36 + static void test_ksyms_module_libbpf(void) 37 37 { 38 38 struct test_ksyms_module *skel; 39 39 int err;
+1 -1
tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c
··· 2 2 #include <test_progs.h> 3 3 #include <network_helpers.h> 4 4 5 - void test_xdp_update_frags(void) 5 + static void test_xdp_update_frags(void) 6 6 { 7 7 const char *file = "./test_xdp_update_frags.o"; 8 8 struct bpf_program *prog;
+2 -2
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
··· 133 133 bpf_object__close(obj); 134 134 } 135 135 136 - void test_xdp_adjust_frags_tail_shrink(void) 136 + static void test_xdp_adjust_frags_tail_shrink(void) 137 137 { 138 138 const char *file = "./test_xdp_adjust_tail_shrink.o"; 139 139 __u32 exp_size; ··· 200 200 bpf_object__close(obj); 201 201 } 202 202 203 - void test_xdp_adjust_frags_tail_grow(void) 203 + static void test_xdp_adjust_frags_tail_grow(void) 204 204 { 205 205 const char *file = "./test_xdp_adjust_tail_grow.o"; 206 206 __u32 exp_size;
+2 -2
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
··· 8 8 9 9 #define IFINDEX_LO 1 10 10 11 - void test_xdp_with_cpumap_helpers(void) 11 + static void test_xdp_with_cpumap_helpers(void) 12 12 { 13 13 struct test_xdp_with_cpumap_helpers *skel; 14 14 struct bpf_prog_info info = {}; ··· 68 68 test_xdp_with_cpumap_helpers__destroy(skel); 69 69 } 70 70 71 - void test_xdp_with_cpumap_frags_helpers(void) 71 + static void test_xdp_with_cpumap_frags_helpers(void) 72 72 { 73 73 struct test_xdp_with_cpumap_frags_helpers *skel; 74 74 struct bpf_prog_info info = {};
+1 -1
tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c
··· 81 81 } 82 82 } 83 83 84 - void test_xdp_with_devmap_frags_helpers(void) 84 + static void test_xdp_with_devmap_frags_helpers(void) 85 85 { 86 86 struct test_xdp_with_devmap_frags_helpers *skel; 87 87 struct bpf_prog_info info = {};