utils: Ensure buffers are flushed after child exits
PATCH 1/1 utils: Ensure buffers are flushed after child exits
We currently wait for the child to exit but we don't flush the buffers. This can mean the output ends up out of sync and the END: line isn't at the end of the logs.
We've recently seen a lot of issues related to this on the autobuilder. Add in a flush call for all fds to ensure buffers are in sync. This does appear to improve warnings on the autobuilder now we started detecting the issue.
Signed-off-by Richard Purdie <[email protected]>
--- README.md | 2 +- utils.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
README.md +1 -1
@@ -49,7 +49,7 @@ $ mtrace ./ptest-runner $MALLOC_TRACE ## Contributions For contribute please send a patch with subject prefix "[ptest-runner]" to [email protected]. [email protected]. ## Links
utils.c +3 -0
@@ -535,6 +535,9 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, entime =time (NULL ); duration = entime - sttime; +/* Now the child has exited, ensure buffers are in sync before writing */ +fflush (NULL ); +if (status) {fprintf (fp,"\nERROR: Exit status is %d\n" , status); rc +=1 ;
Signature · 1 line
2.39.2