selftests/bpf: Do not export subtest as standalone test
authorHou Tao <houtao1@huawei.com>
Tue, 8 Feb 2022 06:54:44 +0000 (14:54 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 8 Feb 2022 20:17:34 +0000 (21:17 +0100)
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
tools/testing/selftests/bpf/prog_tests/ksyms_module.c
tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c

index ecc58c9..a1ebac7 100644 (file)
@@ -6,7 +6,7 @@
 #include "test_ksyms_module.lskel.h"
 #include "test_ksyms_module.skel.h"
 
-void test_ksyms_module_lskel(void)
+static void test_ksyms_module_lskel(void)
 {
        struct test_ksyms_module_lskel *skel;
        int err;
@@ -33,7 +33,7 @@ cleanup:
        test_ksyms_module_lskel__destroy(skel);
 }
 
-void test_ksyms_module_libbpf(void)
+static void test_ksyms_module_libbpf(void)
 {
        struct test_ksyms_module *skel;
        int err;
index 134d0ac..d18e6f3 100644 (file)
@@ -2,7 +2,7 @@
 #include <test_progs.h>
 #include <network_helpers.h>
 
-void test_xdp_update_frags(void)
+static void test_xdp_update_frags(void)
 {
        const char *file = "./test_xdp_update_frags.o";
        struct bpf_program *prog;
index 528a8c3..21ceac2 100644 (file)
@@ -133,7 +133,7 @@ static void test_xdp_adjust_tail_grow2(void)
        bpf_object__close(obj);
 }
 
-void test_xdp_adjust_frags_tail_shrink(void)
+static void test_xdp_adjust_frags_tail_shrink(void)
 {
        const char *file = "./test_xdp_adjust_tail_shrink.o";
        __u32 exp_size;
@@ -200,7 +200,7 @@ out:
        bpf_object__close(obj);
 }
 
-void test_xdp_adjust_frags_tail_grow(void)
+static void test_xdp_adjust_frags_tail_grow(void)
 {
        const char *file = "./test_xdp_adjust_tail_grow.o";
        __u32 exp_size;
index b353e1f..f775a16 100644 (file)
@@ -8,7 +8,7 @@
 
 #define IFINDEX_LO     1
 
-void test_xdp_with_cpumap_helpers(void)
+static void test_xdp_with_cpumap_helpers(void)
 {
        struct test_xdp_with_cpumap_helpers *skel;
        struct bpf_prog_info info = {};
@@ -68,7 +68,7 @@ out_close:
        test_xdp_with_cpumap_helpers__destroy(skel);
 }
 
-void test_xdp_with_cpumap_frags_helpers(void)
+static void test_xdp_with_cpumap_frags_helpers(void)
 {
        struct test_xdp_with_cpumap_frags_helpers *skel;
        struct bpf_prog_info info = {};
index 463a72f..ead4001 100644 (file)
@@ -81,7 +81,7 @@ static void test_neg_xdp_devmap_helpers(void)
        }
 }
 
-void test_xdp_with_devmap_frags_helpers(void)
+static void test_xdp_with_devmap_frags_helpers(void)
 {
        struct test_xdp_with_devmap_frags_helpers *skel;
        struct bpf_prog_info info = {};