summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEmil Tsalapatis <etsal@meta.com>2025-12-05 13:23:14 -0800
committerTejun Heo <tj@kernel.org>2025-12-12 08:18:32 -1000
commit579a3297b268f0281644ead7ff574a2b4bc64d3c (patch)
tree2f9f4ab29ec942523250d83597fad21622f3898d /tools
parentf5e1e5ec204da11fa87fdf006d451d80ce06e118 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/sched_ext/runner.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/sched_ext/runner.c b/tools/testing/selftests/sched_ext/runner.c
index aa2d7d32dda9..5748d2c69903 100644
--- a/tools/testing/selftests/sched_ext/runner.c
+++ b/tools/testing/selftests/sched_ext/runner.c
@@ -46,6 +46,14 @@ static void print_test_preamble(const struct scx_test *test, bool quiet)
if (!quiet)
printf("DESCRIPTION: %s\n", test->description);
printf("OUTPUT:\n");
+
+ /*
+ * The tests may fork with the preamble buffered
+ * in the children's stdout. Flush before the test
+ * to avoid printing the message multiple times.
+ */
+ fflush(stdout);
+ fflush(stderr);
}
static const char *status_to_result(enum scx_test_status status)