All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/1] runner: Flush igt_runner outputs before forking
Date: Wed, 19 Sep 2018 14:49:10 +0300	[thread overview]
Message-ID: <20180919114910.29790-1-petri.latvala@intel.com> (raw)

If the output of igt_runner is piped or redirected, buffered prints
could be left lingering and read as test executable output if execv()
fails. This can happen easily if CI for example generates a testlist
with an incorrect binary name, or an optional test binary (say,
kms_chamelium) is not built for the deployment in question.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/executor.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/runner/executor.c b/runner/executor.c
index 701ca80d..fd262eb4 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -780,6 +780,14 @@ static int execute_entry(size_t idx,
 		printf("\n");
 	}
 
+	/*
+	 * Flush outputs before forking so our (buffered) output won't
+	 * end up in the test outputs.
+	 */
+
+	fflush(stdout);
+	fflush(stderr);
+
 	if ((child = fork())) {
 		int outfd = outpipe[0];
 		int errfd = errpipe[0];
-- 
2.18.0

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

             reply	other threads:[~2018-09-19 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 11:49 Petri Latvala [this message]
2018-09-19 13:23 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] runner: Flush igt_runner outputs before forking Patchwork
2018-09-19 14:49 ` [igt-dev] [PATCH i-g-t 1/1] " Arkadiusz Hiler
2018-09-19 15:34 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] " 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=20180919114910.29790-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tomi.p.sarvela@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.