Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 0/1] lib/igt_core: capture logs for child processes
@ 2025-03-21 11:54 Pawel Sikora
  2025-03-21 11:54 ` [PATCH i-g-t v2 1/1] " Pawel Sikora
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Sikora @ 2025-03-21 11:54 UTC (permalink / raw)
  To: igt-dev
  Cc: Kamil Konieczny, Zbigniew Kempczynski, Petri Latvala,
	Ashutosh Dixit

Add a fix for proper log collection from child processes by the IGT runner.

This change addresses the issue of missing logs for child
processes in the IGT runner:
https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2178

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.

Also, removing unnecessary comment about silent exit.

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

Pawel Sikora (1):
  lib/igt_core: capture logs for child processes

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

-- 
2.34.1


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

* [PATCH i-g-t v2 1/1] lib/igt_core: capture logs for child processes
  2025-03-21 11:54 [PATCH i-g-t v2 0/1] lib/igt_core: capture logs for child processes Pawel Sikora
@ 2025-03-21 11:54 ` Pawel Sikora
  0 siblings, 0 replies; 2+ messages in thread
From: Pawel Sikora @ 2025-03-21 11:54 UTC (permalink / raw)
  To: igt-dev
  Cc: Kamil Konieczny, Zbigniew Kempczynski, Petri Latvala,
	Ashutosh Dixit

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)

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Signed-off-by: Pawel Sikora <pawel.sikora@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


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

end of thread, other threads:[~2025-03-21 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 11:54 [PATCH i-g-t v2 0/1] lib/igt_core: capture logs for child processes Pawel Sikora
2025-03-21 11:54 ` [PATCH i-g-t v2 1/1] " Pawel Sikora

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