app/test: flush stdout after forking
PATCH 1/1 app/test: flush stdout after forking
meson test was not capturing the intended output from the child process; force a flush to ensure it reaches the test log.
--- app/test/process.h | 1 + 1 file changed, 1 insertion(+)
app/test/process.h +1 -0
@@ -110,6 +110,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)for (i =0 ; i < num; i++)printf ("'%s' " , argv_cpy[i]);printf ("\n" ); +fflush (stdout);/* set the environment variable */ if (setenv (RECURSIVE_ENV_VAR , env_value,1 ) !=0 )
Signature · 1 line
2.25.1
Quoted 13 lines · John Levon
meson test was not capturing the intended output from the child process; force a flush to ensure it reaches the test log.
Signed-off-by John Levon <[email protected]>--- app/test/process.h | 1 + 1 file changed, 1 insertion(+)app/test/process.h +0
-0
app/test/process.h process_dup(const char *const argv[], int numargs, const char *env_value) · line 114
Quoted 5 lines
app/test/process.h +1
-0@@ -110,6 +110,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)for (i =0 ; i < num; i++)printf ("'%s' " , argv_cpy[i]);printf ("\n" ); +fflush (stdout);
I thought that "\n" normally flushes in most cases, but if explicit flush is necessary for some cases, let's add it.
Quoted 9 lines · Bruce Richardson
Quoted 8 lines · John Levon
meson test was not capturing the intended output from the child process; force a flush to ensure it reaches the test log.
Signed-off-by John Levon <[email protected]>--- app/test/process.h | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
app/test/process.h process_dup(const char *const argv[], int numargs, const char *env_value) · line 114
Quoted 10 lines
app/test/process.h +1
-0@@ -110,6 +110,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)for (i =0 ; i < num; i++)printf ("'%s' " , argv_cpy[i]);printf ("\n" ); +fflush (stdout);I thought that "\n" normally flushes in most cases, but if explicit flush is necessary for some cases, let's add it.
stdout is only line-buffered if it's to a tty, but regardless, meson test appears to wrap all output into tmp files. I didn't dig into exactly what's going on with meson (or why the fork() matters), but certainly you don't get this output *at all* under meson test (even with -v), but you do running dpdk_test directly.
Furthermore, looks like others have found the same thing as there are several other direct fflush()es.
regards
john
Thomas Monjalon
Applied26/07/2021 14:27, Bruce Richardson:
Quoted 7 lines · John Levon
Quoted 4 lines
meson test was not capturing the intended output from the child process; force a flush to ensure it reaches the test log.
Signed-off-by John Levon <[email protected]>Acked-by Bruce Richardson <[email protected]>
Applied, thanks.