public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jan Sokolowski <jan.sokolowski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: zbigniew.kempczynski@intel.com, peter.senna@linux.intel.com,
	piotr.rudnicki@intel.com,
	Jan Sokolowski <jan.sokolowski@intel.com>
Subject: [PATCH i-g-t v1 1/1] lib/igt_core: flush output on each line
Date: Wed, 25 Mar 2026 12:49:01 +0100	[thread overview]
Message-ID: <20260325114901.256229-1-jan.sokolowski@intel.com> (raw)

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


             reply	other threads:[~2026-03-25 11:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 11:49 Jan Sokolowski [this message]
2026-03-25 14:30 ` [PATCH i-g-t v1 1/1] lib/igt_core: flush output on each line 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260325114901.256229-1-jan.sokolowski@intel.com \
    --to=jan.sokolowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=peter.senna@linux.intel.com \
    --cc=piotr.rudnicki@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox