On Mon, Apr 18, 2022 at 3:27 PM Mykola Lysenko <mykolal@xxxxxx> wrote: > > 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@xxxxxx> > --- I've added %-3d to test number output so that it's a bit more aligned: #178 test_global_funcs:OK #173 tcp_hdr_options:OK #50 d_path:OK #132 send_signal:OK #23 btf_map_in_map:OK #10 bpf_iter:OK #184 test_skb_pkt_end:OK #185 test_strncmp:OK #46 core_reloc_btfgen:SKIP And applied to bpf-next, thanks. Looking forward to subtest logging improvements! > .../selftests/bpf/prog_tests/bpf_mod_race.c | 4 +- > .../bpf/prog_tests/prog_tests_framework.c | 56 +++ > tools/testing/selftests/bpf/test_progs.c | 327 +++++++----------- > tools/testing/selftests/bpf/test_progs.h | 35 +- > 4 files changed, 202 insertions(+), 220 deletions(-) > create mode 100644 tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c > [...] > > /* A bunch of tests set custom affinity per-thread and/or per-process. Reset > @@ -219,72 +205,79 @@ static void restore_netns(void) > void test__end_subtest(void) > { > struct prog_test_def *test = env.test; > - int sub_error_cnt = test->error_cnt - test->old_error_cnt; > + struct test_state *state = env.test_state; > this empty lines was breaking variable declaration block into two separate blocks, I've removed an empty line here > - dump_test_log(test, sub_error_cnt); > + int sub_error_cnt = state->error_cnt - state->old_error_cnt; > > fprintf(stdout, "#%d/%d %s/%s:%s\n", [...]