selftests/bpf: fix clearing buffered output between tests/subtests
Subsystems (5)
PATCH v2 1/1 selftests/bpf: fix clearing buffered output between tests/subtests
Clear buffered output once test or subtests finishes even if test was successful. Not doing this leads to accumulation of output from previous tests and on first failed tests lots of irrelevant output will be dumped, greatly confusing things.
v1->v2: fix Fixes tag, add more context to patch
Fixes 3a516a0a3a7b ("selftests/bpf: add sub-tests support for test_progs")
Signed-off-by Andrii Nakryiko <[email protected]>
--- tools/testing/selftests/bpf/test_progs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_progs.c +1 -1
@@ -39,22 +39,22 @@ static bool should_run(struct test_selector *sel, int num, const char *name) }static void dump_test_log (const struct prog_test_def *test,bool failed) {if (env.verbose || test->force_log || failed) {if (env.log_cnt) {fprintf (stdout,"%s" , env.log_buf);if (env.log_buf[env.log_cnt -1 ] !='\n' )fprintf (stdout,"\n" ); } - env.log_cnt =0 ; } + env.log_cnt =0 ; }void test__end_subtest () {struct prog_test_def *test = env.test;int sub_error_cnt = error_cnt - test->old_error_cnt;if (sub_error_cnt) env.fail_cnt++;else
Signature · 1 line
2.17.1
Alexei Starovoitov
AppliedQuoted 10 lines · Andrii Nakryiko
Clear buffered output once test or subtests finishes even if test was successful. Not doing this leads to accumulation of output from previous tests and on first failed tests lots of irrelevant output will be dumped, greatly confusing things.
v1->v2: fix Fixes tag, add more context to patchFixes 3a516a0a3a7b ("selftests/bpf: add sub-tests support for test_progs")Signed-off-by Andrii Nakryiko <[email protected]>
Applied. Thanks