OSDN Git Service

selftests/bpf: abstract away test log output
authorAndrii Nakryiko <andriin@fb.com>
Sun, 28 Jul 2019 03:25:28 +0000 (20:25 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 28 Jul 2019 05:36:19 +0000 (22:36 -0700)
commit0ff97e56c0986ea6633083c3487d9231bbbd881b
tree5e07c2f43f18292f7298a9afd34cb7410181eab1
parent329e38f76cc2a77085264ce6e0dbe902c33fd7a3
selftests/bpf: abstract away test log output

This patch changes how test output is printed out. By default, if test
had no errors, the only output will be a single line with test number,
name, and verdict at the end, e.g.:

  #31 xdp:OK

If test had any errors, all log output captured during test execution
will be output after test completes.

It's possible to force output of log with `-v` (`--verbose`) option, in
which case output won't be buffered and will be output immediately.

To support this, individual tests are required to use helper methods for
logging: `test__printf()` and `test__vprintf()`.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
12 files changed:
tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c
tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
tools/testing/selftests/bpf/prog_tests/l4lb_all.c
tools/testing/selftests/bpf/prog_tests/map_lock.c
tools/testing/selftests/bpf/prog_tests/send_signal.c
tools/testing/selftests/bpf/prog_tests/spinlock.c
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id.c
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h