diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-03-13 10:23:33 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-03-13 23:30:53 +0100 |
commit | 3e2671fb9a95d2b46990832466383ec8384d88a3 (patch) | |
tree | b71e83c60faef2de1a4704f4e10bad681227c461 /tools/testing/selftests/bpf/test_progs.h | |
parent | 30b4cb36b11144e29b4f837057f8ab31aac10b8a (diff) | |
download | lwn-3e2671fb9a95d2b46990832466383ec8384d88a3.tar.gz lwn-3e2671fb9a95d2b46990832466383ec8384d88a3.zip |
selftests/bpf: Ensure consistent test failure output
printf() doesn't seem to honor using overwritten stdout/stderr (as part of
stdio hijacking), so ensure all "standard" invocations of printf() do
fprintf(stdout, ...) instead.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200313172336.1879637-2-andriin@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.h')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index bcfa9ef23fda..fd85fa61dbf7 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -109,10 +109,10 @@ extern struct ipv6_packet pkt_v6; int __save_errno = errno; \ if (__ret) { \ test__fail(); \ - printf("%s:FAIL:%s ", __func__, tag); \ - printf(format); \ + fprintf(stdout, "%s:FAIL:%s ", __func__, tag); \ + fprintf(stdout, ##format); \ } else { \ - printf("%s:PASS:%s %d nsec\n", \ + fprintf(stdout, "%s:PASS:%s %d nsec\n", \ __func__, tag, duration); \ } \ errno = __save_errno; \ @@ -124,7 +124,7 @@ extern struct ipv6_packet pkt_v6; int __save_errno = errno; \ if (__ret) { \ test__fail(); \ - printf("%s:FAIL:%d\n", __func__, __LINE__); \ + fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__); \ } \ errno = __save_errno; \ __ret; \ |