summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2018-09-19 14:49:10 +0300
committerPetri Latvala <petri.latvala@intel.com>2018-09-19 17:50:44 +0300
commitae8187922d8de2bc739519da3bd40cf5f03f5e4f (patch)
tree60168024376e3d39e17d4875805bc64481f781f9 /runner
parentd409cc6f234fbc0122c64be27ba85b5603658de5 (diff)
runner: Flush igt_runner outputs before forking
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> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c8
1 files changed, 8 insertions, 0 deletions
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];