Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/2] runner: Inject a message when killing test to taints
Date: Thu, 18 Jun 2020 15:06:22 +0300	[thread overview]
Message-ID: <20200618120623.6853-1-petri.latvala@intel.com> (raw)

Normally runner injecting a message to the test's stdout/stderr logs
has a race condition; The test outputs have special lines (subtest
starting/ending) and accidentally injecting stuff in between would
cause funky results.

When we're killing a test because the kernel got tainted, we know
already that we're not getting a subtest ending line and we can
inject, if we make sure we have newlines printed before and after the
injection.

Having a message in the stdout of the test will aid automatic bug
filtering.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/executor.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/runner/executor.c b/runner/executor.c
index 06390262..7bb2b14c 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1049,9 +1049,27 @@ static int monitor_output(pid_t child,
 				 * the result an incomplete we avoid
 				 * journaling a timeout here.
 				 */
-				if (is_tainted(taints))
+				if (is_tainted(taints)) {
 					exitline = EXECUTOR_EXIT;
 
+					/*
+					 * Also inject a message to
+					 * the test's stdout. As we're
+					 * shooting for an incomplete
+					 * anyway, we don't need to
+					 * care if we're not between
+					 * full lines from stdout. We
+					 * do need to make sure we
+					 * have newlines on both ends
+					 * of this injection though.
+					 */
+					dprintf(outputs[_F_OUT],
+						"\nrunner: This test was killed due to a kernel taint (0x%lx).\n",
+						taints);
+					if (settings->sync)
+						fdatasync(outputs[_F_OUT]);
+				}
+
 				dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n",
 					exitline,
 					status, time);
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2020-06-18 12:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 12:06 Petri Latvala [this message]
2020-06-18 12:06 ` [igt-dev] [PATCH i-g-t 2/2] runner: Introduce --disk-usage-limit Petri Latvala
2020-06-18 12:26   ` Arkadiusz Hiler
2020-06-18 12:49     ` Petri Latvala
2020-06-18 12:52       ` Arkadiusz Hiler
2020-06-18 12:26 ` [igt-dev] [PATCH i-g-t 1/2] runner: Inject a message when killing test to taints Arkadiusz Hiler
2020-06-18 13:24 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2020-06-18 13:29   ` Petri Latvala
2020-06-18 14:22 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-06-18 15:32 ` [igt-dev] ✗ GitLab.Pipeline: warning " 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=20200618120623.6853-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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