Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Sikora <pawel.sikora@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Zbigniew Kempczynski <zbigniew.kempczynski@intel.com>,
	Petri Latvala <adrinael@adrinael.net>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>
Subject: [PATCH i-g-t v2 1/1] lib/igt_core: capture logs for child processes
Date: Fri, 21 Mar 2025 12:54:33 +0100	[thread overview]
Message-ID: <20250321115433.736043-2-pawel.sikora@linux.intel.com> (raw)
In-Reply-To: <20250321115433.736043-1-pawel.sikora@linux.intel.com>

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


      reply	other threads:[~2025-03-21 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20250321115433.736043-2-pawel.sikora@linux.intel.com \
    --to=pawel.sikora@linux.intel.com \
    --cc=adrinael@adrinael.net \
    --cc=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.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