Skip to content

Commit 579a329

Browse files
etsalhtejun
authored andcommitted
selftests/sched_ext: flush stdout before test to avoid log spam
The sched_ext selftests runner runs each test in the same process, with each test possibly forking multiple times. When the main runner has not flushed its stdout, the children inherit the buffered output for previous tests and emit it during exit. This causes log spam. Make sure stdout/stderr is fully flushed before each test. Cc: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent f5e1e5e commit 579a329

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • tools/testing/selftests/sched_ext

tools/testing/selftests/sched_ext/runner.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ static void print_test_preamble(const struct scx_test *test, bool quiet)
4646
if (!quiet)
4747
printf("DESCRIPTION: %s\n", test->description);
4848
printf("OUTPUT:\n");
49+
50+
/*
51+
* The tests may fork with the preamble buffered
52+
* in the children's stdout. Flush before the test
53+
* to avoid printing the message multiple times.
54+
*/
55+
fflush(stdout);
56+
fflush(stderr);
4957
}
5058

5159
static const char *status_to_result(enum scx_test_status status)

0 commit comments

Comments
 (0)