selftests/resctrl: Flush stdout file buffer before executing fork()
authorShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Thu, 13 Apr 2023 07:22:56 +0000 (16:22 +0900)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 13 Apr 2023 17:34:12 +0000 (11:34 -0600)
commita080b6e74b241dbc7e13dd378d6f6fc884579196
treeb572b6b6ab420e132cc9f0d4d957398f312de376
parent1e359b6a9422a2bdef14798d539e9d5783bdd5c1
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>
tools/testing/selftests/resctrl/cat_test.c
tools/testing/selftests/resctrl/resctrl_val.c
tools/testing/selftests/resctrl/resctrlfs.c