[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc45d372-91cf-a909-aa8b-4daa755e758f@fb.com>
Date: Mon, 7 Feb 2022 10:17:00 -0800
From: Yonghong Song <yhs@...com>
To: Hou Tao <hotforest@...il.com>,
Daniel Borkmann <daniel@...earbox.net>
CC: Alexei Starovoitov <ast@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Andrii Nakryiko <andrii@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
<netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
<houtao1@...wei.com>
Subject: Re: [PATCH bpf-next v4 1/2] selftests/bpf: do not export subtest as
standalone test
On 2/5/22 8:31 PM, Hou Tao wrote:
> 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'
>
> Find out that other tests also have the similar problem, so fix
> these tests by marking subtests in these tests as static. For
> xdp_adjust_frags.c, there is just one subtest, so just export
> the subtest directly.
>
> Signed-off-by: Hou Tao <houtao1@...wei.com>
> ---
> tools/testing/selftests/bpf/prog_tests/ksyms_module.c | 4 ++--
> tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c | 6 ------
> tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c | 4 ++--
> tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 4 ++--
> tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c | 2 +-
> 5 files changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/ksyms_module.c b/tools/testing/selftests/bpf/prog_tests/ksyms_module.c
> index ecc58c9e7631..a1ebac70ec29 100644
> --- a/tools/testing/selftests/bpf/prog_tests/ksyms_module.c
> +++ b/tools/testing/selftests/bpf/prog_tests/ksyms_module.c
> @@ -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 @@ void test_ksyms_module_lskel(void)
> 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;
> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c
> index 134d0ac32f59..fc2d8fa8dac5 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_frags.c
> @@ -102,9 +102,3 @@ void test_xdp_update_frags(void)
> out:
> bpf_object__close(obj);
> }
> -
> -void test_xdp_adjust_frags(void)
> -{
> - if (test__start_subtest("xdp_adjust_frags"))
> - test_xdp_update_frags();
> -}
I suggest keep test_xdp_adjust_frags and mark
test_xdp_update_frags as static function, and
this is also good for future extension.
It is confusing that test_xdp_update_frags
test in file xdp_adjust_frags.c. Typical
prog_tests/ test has {test,serial_test}_<TEST> test
with file name <TEST>.c file.
[...]
Powered by blists - more mailing lists