diff mbox series

[ptest-runner,5/5] Flush stdout and stderr after test

Message ID 20230718172614.469304-6-JPEWhacker@gmail.com
State New
Headers show
Series Fix ptest timeout errors | expand

Commit Message

Joshua Watt July 18, 2023, 5:26 p.m. UTC
After reporting test results, flush the output buffers to ensure the
files are written out. Also flush again at the end of running all tests

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 utils.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/utils.c b/utils.c
index bd52544..59b8b77 100644
--- a/utils.c
+++ b/utils.c
@@ -601,6 +601,9 @@  run_ptests(struct ptest_list *head, const struct ptest_options opts,
 			do_close(&pipefd_stderr[PIPE_READ]);
 			do_close(&pipefd_stderr[PIPE_WRITE]);
 
+			fflush(fp);
+			fflush(fp_stderr);
+
 		PTEST_LIST_ITERATE_END
 		fprintf(fp, "STOP: %s\n", progname);
 	} while (0);
@@ -611,6 +614,9 @@  run_ptests(struct ptest_list *head, const struct ptest_options opts,
 	if (opts.xml_filename)
 		xml_finish(xh);
 
+	fflush(fp);
+	fflush(fp_stderr);
+
 	return rc;
 }