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, mika.kuoppala@intel.com,
Jan Sokolowski <jan.sokolowski@intel.com>
Subject: [PATCH i-g-t v2 1/1] lib/igt_core: flush output on each line
Date: Thu, 16 Apr 2026 10:39:10 +0200 [thread overview]
Message-ID: <20260416083910.1011732-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>
---
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
next reply other threads:[~2026-04-16 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 8:39 Jan Sokolowski [this message]
2026-04-16 12:39 ` [PATCH i-g-t v2 1/1] lib/igt_core: flush output on each line 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
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=20260416083910.1011732-1-jan.sokolowski@intel.com \
--to=jan.sokolowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mika.kuoppala@intel.com \
--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