diff mbox series

[v2,bpf-next,3/5] Correctly display subtest skip status

Message ID 20210810001625.1140255-4-fallentree@fb.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series 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 10 maintainers not CCed: daniel@iogearbox.net netdev@vger.kernel.org john.fastabend@gmail.com linux-kselftest@vger.kernel.org shuah@kernel.org songliubraving@fb.com 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 success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
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, 12:16 a.m. UTC
In skip_account(), test->skip_cnt is set to 0 at the end, this makes
next print statement never display SKIP status for the subtest. This
patch moves the accounting logic after the print statement, fixing the
issue.

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

Comments

Andrii Nakryiko Aug. 10, 2021, 5:47 p.m. UTC | #1
On Mon, Aug 9, 2021 at 5:17 PM Yucong Sun <fallentree@fb.com> wrote:
>
> In skip_account(), test->skip_cnt is set to 0 at the end, this makes
> next print statement never display SKIP status for the subtest. This
> patch moves the accounting logic after the print statement, fixing the
> issue.
>
> Signed-off-by: Yucong Sun <fallentree@fb.com>
> ---

Looks good, but seems like we are not printing SKIP for normal tests,
let's do that while we are at fixing SKIP reporting?

>  tools/testing/selftests/bpf/test_progs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> index c5bffd2e78ae..82d012671552 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -238,18 +238,18 @@ void test__end_subtest()
>         struct prog_test_def *test = env.test;
>         int sub_error_cnt = test->error_cnt - test->old_error_cnt;
>
> -       if (sub_error_cnt)
> -               env.fail_cnt++;
> -       else if (test->skip_cnt == 0)
> -               env.sub_succ_cnt++;
> -       skip_account();
> -
>         dump_test_log(test, sub_error_cnt);
>
>         fprintf(env.stdout, "#%d/%d %s:%s\n",
>                test->test_num, test->subtest_num, test->subtest_name,
>                sub_error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK"));
>
> +       if (sub_error_cnt)
> +               env.fail_cnt++;
> +       else if (test->skip_cnt == 0)
> +               env.sub_succ_cnt++;
> +       skip_account();
> +
>         free(test->subtest_name);
>         test->subtest_name = NULL;
>  }
> --
> 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 c5bffd2e78ae..82d012671552 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -238,18 +238,18 @@  void test__end_subtest()
 	struct prog_test_def *test = env.test;
 	int sub_error_cnt = test->error_cnt - test->old_error_cnt;
 
-	if (sub_error_cnt)
-		env.fail_cnt++;
-	else if (test->skip_cnt == 0)
-		env.sub_succ_cnt++;
-	skip_account();
-
 	dump_test_log(test, sub_error_cnt);
 
 	fprintf(env.stdout, "#%d/%d %s:%s\n",
 	       test->test_num, test->subtest_num, test->subtest_name,
 	       sub_error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK"));
 
+	if (sub_error_cnt)
+		env.fail_cnt++;
+	else if (test->skip_cnt == 0)
+		env.sub_succ_cnt++;
+	skip_account();
+
 	free(test->subtest_name);
 	test->subtest_name = NULL;
 }