diff options
author | Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> | 2023-04-13 10:22:56 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-04-13 20:34:12 +0300 |
commit | a080b6e74b241dbc7e13dd378d6f6fc884579196 (patch) | |
tree | b572b6b6ab420e132cc9f0d4d957398f312de376 /tools/testing/selftests/resctrl/resctrl_val.c | |
parent | 1e359b6a9422a2bdef14798d539e9d5783bdd5c1 (diff) | |
download | linux-a080b6e74b241dbc7e13dd378d6f6fc884579196.tar.xz |
selftests/resctrl: Flush stdout file buffer before executing fork()
When a process has buffered output, a child process created by fork()
will also copy buffered output. When using kselftest framework,
the output (resctrl test result message) will be printed multiple times.
Add fflush() to flush out the buffered output before executing fork().
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl_val.c')
-rw-r--r-- | tools/testing/selftests/resctrl/resctrl_val.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index 00864242d76c..e632657995c7 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -629,6 +629,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param) * Fork to start benchmark, save child's pid so that it can be killed * when needed */ + fflush(stdout); bm_pid = fork(); if (bm_pid == -1) { perror("# Unable to fork"); |