diff mbox series

[v3,bpf-next,4/4] selftests/bpf: also print test name in subtest status message

Message ID 20210810212107.2237868-5-fallentree@fb.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series selftests/bpf: Improve the usability of test_progs | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 12 maintainers not CCed: netdev@vger.kernel.org john.fastabend@gmail.com linux-kselftest@vger.kernel.org shuah@kernel.org davem@davemloft.net hawk@kernel.org songliubraving@fb.com kuba@kernel.org ast@kernel.org yhs@fb.com kpsingh@kernel.org kafai@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning CHECK: Alignment should match open parenthesis WARNING: line length of 86 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yucong Sun Aug. 10, 2021, 9:21 p.m. UTC
This patch add test name in subtest status message line, making it possible to
grep ':OK' in the output to generate a list of passed test+subtest names, which
can be processed to generate argument list to be used with "-a", "-d" exact
string matching.

Example: $sudo ./test_progs -a 'xdp*' 2>/dev/null | grep ":OK" | cut -d":" -f 1
| cut -d" " -f2- | paste -s -d,
xdp_adjust_tail/xdp_adjust_tail_shrink,xdp,xdp_devmap_attach/Verifier check of
DEVMAP programs,xdp_info,xdp_noinline,xdp_perf

Signed-off-by: Yucong Sun <fallentree@fb.com>
---
 tools/testing/selftests/bpf/test_progs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrii Nakryiko Aug. 11, 2021, 9:44 p.m. UTC | #1
On Tue, Aug 10, 2021 at 2:21 PM Yucong Sun <fallentree@fb.com> wrote:
>
> This patch add test name in subtest status message line, making it possible to
> grep ':OK' in the output to generate a list of passed test+subtest names, which
> can be processed to generate argument list to be used with "-a", "-d" exact
> string matching.
>
> Example: $sudo ./test_progs -a 'xdp*' 2>/dev/null | grep ":OK" | cut -d":" -f 1
> | cut -d" " -f2- | paste -s -d,
> xdp_adjust_tail/xdp_adjust_tail_shrink,xdp,xdp_devmap_attach/Verifier check of
> DEVMAP programs,xdp_info,xdp_noinline,xdp_perf

This looks a bit like a mess in the commit log. I think it's a bit
more useful if you just paste a few lines of the new output format as
is, with no post-processing.

But overall it makes sense. I remember Alexei thought that it's
unnecessary verbosity, but since then I often found it useful to be
able to know the full test/subtest specifier, so I'm all for it.

>
> Signed-off-by: Yucong Sun <fallentree@fb.com>
> ---
>  tools/testing/selftests/bpf/test_progs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> index af43e206a806..23e4ea51f9e7 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -182,8 +182,8 @@ void test__end_subtest()
>
>         dump_test_log(test, sub_error_cnt);
>
> -       fprintf(env.stdout, "#%d/%d %s:%s\n",
> -              test->test_num, test->subtest_num, test->subtest_name,
> +       fprintf(env.stdout, "#%d/%d %s/%s:%s\n",
> +              test->test_num, test->subtest_num, test->test_name, test->subtest_name,
>                sub_error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK"));
>
>         if (sub_error_cnt)
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index af43e206a806..23e4ea51f9e7 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -182,8 +182,8 @@  void test__end_subtest()
 
 	dump_test_log(test, sub_error_cnt);
 
-	fprintf(env.stdout, "#%d/%d %s:%s\n",
-	       test->test_num, test->subtest_num, test->subtest_name,
+	fprintf(env.stdout, "#%d/%d %s/%s:%s\n",
+	       test->test_num, test->subtest_num, test->test_name, test->subtest_name,
 	       sub_error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK"));
 
 	if (sub_error_cnt)