[PATCH i-g-t v3 1/1] lib/igt_core: capture logs for child processes

Pawel Sikora pawel.sikora at linux.intel.com
Fri Mar 21 12:03:44 UTC 2025


This change addresses the issue of missing logs for child
processes in the IGT runner.

The '_igt_log_buffer_dump()' function is now called before
exiting child processes, ensuring that logs are properly
captured and not lost when IGT fails and child processes
dump logs before exiting.

v2: Make the dump conditional based on active comms (Kamil)

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2178

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Pawel Sikora <pawel.sikora at linux.intel.com>
---
 lib/igt_core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index c19689a51..512d88437 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -296,6 +296,7 @@ static bool in_fixture = false;
 static bool test_with_subtests = false;
 static bool in_atexit_handler = false;
 static bool show_ftrace = false;
+static bool has_comms = false;
 static enum {
 	CONT = 0, SKIP, FAIL
 } skip_subtests_henceforth = CONT;
@@ -1905,11 +1906,17 @@ void igt_fail(int exitcode)
 		failed_one = true;
 	}
 
-	/* Silent exit, parent will do the yelling. */
+	/* If igt_runner uses comms, it could grab each child's logs without
+	 * them interleaving in stdout/stderr. */
+	has_comms = runner_connected();
+	if (has_comms)
+		_igt_log_buffer_dump();
+
 	if (test_child)
 		exit(exitcode);
 
-	_igt_log_buffer_dump();
+	if (!has_comms)
+		_igt_log_buffer_dump();
 
 	if (test_multi_fork_child)
 		exit(exitcode);
-- 
2.34.1



More information about the igt-dev mailing list