public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 1/1] lib/igt_core: flush output on each line
@ 2026-04-16  8:39 Jan Sokolowski
  2026-04-16 12:39 ` Kamil Konieczny
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jan Sokolowski @ 2026-04-16  8:39 UTC (permalink / raw)
  To: igt-dev
  Cc: zbigniew.kempczynski, peter.senna, piotr.rudnicki, mika.kuoppala,
	Jan Sokolowski

It was found while running tests that if a test launches threads with
even more subthreads, some igt_debug calls might not print their lines.

Fflush after each line to make sure we see everything we want to see.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
---

v2: Only flushes if no runner is connected as it's not needed otherwise.

---
 lib/igt_core.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 65325f08d4..4479201972 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -3294,10 +3294,8 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	pthread_mutex_lock(&print_mutex);
 
 	/* use stderr for warning messages and above */
-	if (level >= IGT_LOG_WARN) {
+	if (level >= IGT_LOG_WARN)
 		file = stderr;
-		fflush(stdout);
-	}
 	else
 		file = stdout;
 
@@ -3309,6 +3307,13 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 		_log_line_fprintf(file, "%s%s", thread_id, line);
 	}
 
+	/* Ensure output is flushed explicitly, as concurrent test threads
+	 * may otherwise cause messages to be dropped or reordered.
+	 * Runner uses sockets so it's not needed there.
+	 */
+	if (!runner_connected())
+		fflush(file);
+
 	pthread_mutex_unlock(&print_mutex);
 
 out:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-17  1:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16  8:39 [PATCH i-g-t v2 1/1] lib/igt_core: flush output on each line Jan Sokolowski
2026-04-16 12:39 ` Kamil Konieczny
2026-04-16 13:58 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,v2,1/1] " Patchwork
2026-04-16 14:24 ` ✓ i915.CI.BAT: " Patchwork
2026-04-16 15:01 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-17  1:28 ` ✓ i915.CI.Full: success " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox