Skip to contentSkip to conversation

selftests/sched_ext: flush stdout before test to avoid log spam

PATCH Applied Emil Tsalapatis 2 participants 3 messages Dec 5, 2025 – Dec 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

---
 tools/testing/selftests/sched_ext/runner.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/testing/selftests/sched_ext/runner.c +8 -0
index aa2d7d32dda9..5748d2c69903 100644
@@ -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)
Signature · 1 line
2.47.3
reviewer Applied
#1 lore raw

Applied to sched_ext/for-6.19-fixes.

Thanks.

--
tejun