public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v1 1/1] lib/igt_core: flush output on each line
@ 2026-03-25 11:49 Jan Sokolowski
  2026-03-25 14:30 ` Rudnicki, Piotr
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Jan Sokolowski @ 2026-03-25 11:49 UTC (permalink / raw)
  To: igt-dev; +Cc: zbigniew.kempczynski, peter.senna, piotr.rudnicki, 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>
---
 lib/igt_core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 65325f08d..ed4f48d86 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,11 @@ 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.
+	 */
+	fflush(file);
+
 	pthread_mutex_unlock(&print_mutex);
 
 out:
-- 
2.43.0


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

end of thread, other threads:[~2026-04-13  9:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 11:49 [PATCH i-g-t v1 1/1] lib/igt_core: flush output on each line Jan Sokolowski
2026-03-25 14:30 ` Rudnicki, Piotr
2026-03-25 14:40 ` Rudnicki, Piotr
2026-03-25 18:36 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,v1,1/1] " Patchwork
2026-03-25 18:51 ` ✓ i915.CI.BAT: " Patchwork
2026-03-26  3:05 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-26  4:19 ` ✗ i915.CI.Full: failure " Patchwork
2026-03-26 15:39 ` [PATCH i-g-t v1 1/1] " Zbigniew Kempczyński
2026-04-10 14:09   ` Kamil Konieczny
2026-04-13  9:30     ` Zbigniew Kempczyński

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