selftests/bpf: Refactor prog_tests logging and test execution
authorMykola Lysenko <mykolal@fb.com>
Mon, 18 Apr 2022 22:25:07 +0000 (15:25 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 19 Apr 2022 04:22:13 +0000 (21:22 -0700)
commit2324257dbd6889638c6cba1ade9eeac3224e2043
tree6975aff94f5198c79d77a88807c617cdcfb93add
parent0fb53aabc5fcdf848ec7adc777baff25a1c6c335
selftests/bpf: Refactor prog_tests logging and test execution

This is a pre-req to add separate logging for each subtest in
test_progs.

Move all the mutable test data to the test_result struct.
Move per-test init/de-init into the run_one_test function.
Consolidate data aggregation and final log output in
calculate_and_print_summary function.
As a side effect, this patch fixes double counting of errors
for subtests and possible duplicate output of subtest log
on failures.

Also, add prog_tests_framework.c test to verify some of the
counting logic.

As part of verification, confirmed that number of reported
tests is the same before and after the change for both parallel
and sequential test execution.

Signed-off-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220418222507.1726259-1-mykolal@fb.com
tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c
tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h