diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2020-08-26 10:17:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-09 19:04:26 +0200 |
commit | 0430561c8e0f4b497b29a169445e2477c607e27b (patch) | |
tree | ef617ffd5ad1c59ec0484726b399ab030d7f46a2 /tools/testing | |
parent | 05163210d6abcee771d3526fa78bf6b00b2c2041 (diff) | |
download | linux-stable-0430561c8e0f4b497b29a169445e2477c607e27b.tar.gz linux-stable-0430561c8e0f4b497b29a169445e2477c607e27b.tar.bz2 linux-stable-0430561c8e0f4b497b29a169445e2477c607e27b.zip |
selftests/bpf: Fix massive output from test_maps
[ Upstream commit fa4505675e093e895b7ec49a76d44f6b5ad9602e ]
When stdout output from the selftests tool 'test_maps' gets redirected
into e.g file or pipe, then the output lines increase a lot (from 21
to 33949 lines). This is caused by the printf that happens before the
fork() call, and there are user-space buffered printf data that seems
to be duplicated into the forked process.
To fix this fflush() stdout before the fork loop in __run_parallel().
Fixes: 1a97cf1fe503 ("selftests/bpf: speedup test_maps")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/159842985651.1050885.2154399297503372406.stgit@firesoul
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/bpf/test_maps.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index 9b552c0fc47d..4e202217fae1 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -1017,6 +1017,8 @@ static void __run_parallel(int tasks, void (*fn)(int task, void *data), pid_t pid[tasks]; int i; + fflush(stdout); + for (i = 0; i < tasks; i++) { pid[i] = fork(); if (pid[i] == 0) { |