Skip to contentSkip to conversation

selftests/bpf: fix clearing buffered output between tests/subtests

PATCH Superseded Andrii Nakryiko 1 participant 1 message Jul 30, 2019

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

Fixed: 3a516a0a3a7b ("selftests/bpf: add sub-tests support for test_progs")

---
 tools/testing/selftests/bpf/test_progs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_progs.c +1 -1
index 546d99b3ec34..db00196c8315 100644
@@ -46,8 +46,8 @@ static void dump_test_log(const struct prog_test_def *test, bool failed)
 			if (env.log_buf[env.log_cnt - 1] != '\n')
 				fprintf(stdout, "\n");
 		}
-		env.log_cnt = 0;
 	}
+	env.log_cnt = 0;
 }
 
 void test__end_subtest()
Signature · 1 line
2.17.1