summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2020-06-18 15:06:22 +0300
committerPetri Latvala <petri.latvala@intel.com>2020-07-20 11:04:17 +0300
commitf0f0122e9f20e85597451730fb05691f3481eb38 (patch)
treed01c1c44d664800e8f57f45e885bb4241422e3a8 /runner
parent9b964d7359db9799f2b5b905403dda668ae28c87 (diff)
runner: Inject a message when killing test to taints
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> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c20
1 files changed, 19 insertions, 1 deletions
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);