[igt-dev] [PATCH i-g-t 1/1] runner: Flush igt_runner outputs before forking
Petri Latvala
petri.latvala at intel.com
Wed Sep 19 11:49:10 UTC 2018
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 at intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at 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
More information about the igt-dev
mailing list