mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
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>
This commit is contained in:
parent
1e359b6a94
commit
a080b6e74b
|
|
@ -167,6 +167,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type)
|
|||
return errno;
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
bm_pid = fork();
|
||||
|
||||
/* Set param values for child thread which will be allocated bitmask
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -678,6 +678,7 @@ int filter_dmesg(void)
|
|||
perror("pipe");
|
||||
return ret;
|
||||
}
|
||||
fflush(stdout);
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
close(pipefds[0]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user