On Wed, Sep 15, 2021 at 8:26 PM Yucong Sun <fallentree@xxxxxx> wrote: > > From: Yucong Sun <sunyucong@xxxxxxxxx> > > This patch adds "-j" mode to test_progs, executing tests in multiple process. > "-j" mode is optional, and works with all existing test selection mechanism, as > well as "-v", "-l" etc. > > In "-j" mode, main process use UDS to communicate to each forked worker, > commanding it to run tests and collect logs. After all tests are > finished, a summary is printed. main process use multiple competing > threads to dispatch work to worker, trying to keep them all busy. > > The test status will be printed as soon as it is finished, if there are error > logs, it will be printed after the final summary line. > > By specifying "--debug", additional debug information on server/worker > communication will be printed. > > Example output: > > ./test_progs -n 15-20 -j > [ 12.801730] bpf_testmod: loading out-of-tree module taints kernel. > Launching 8 workers. > #20 btf_split:OK > #16 btf_endian:OK > #18 btf_module:OK > #17 btf_map_in_map:OK > #19 btf_skc_cls_ingress:OK > #15 btf_dump:OK > Summary: 6/20 PASSED, 0 SKIPPED, 0 FAILED > > Signed-off-by: Yucong Sun <sunyucong@xxxxxxxxx> > --- A bit late to review this, sorry. I'm still looking through the code, but decided to try it out locally first. And here's what I got immediately running in QEMU: [vmuser@archvm bpf]$ time sudo ./test_progs -t core #32 core_autosize:OK #33 core_extern:OK #34 core_read_macros:OK #35 core_reloc:OK #36 core_retro:OK Summary: 5/107 PASSED, 0 SKIPPED, 0 FAILED real 0m0.927s user 0m0.197s sys 0m0.103s [vmuser@archvm bpf]$ time sudo ./test_progs -t core -j Launching 8 workers. #34 core_read_macros:OK #32 core_autosize:OK #36 core_retro:OK #33 core_extern:OK #35 core_reloc:OK Summary: 5/107 PASSED, 0 SKIPPED, 0 FAILED real 0m20.048s user 0m0.194s sys 0m0.183s So, first, "Launching 8 workers." should be only displayed with --debug, no? But most importantly, why does the parallel version take 20 seconds?.. Please take a look, something is not right. > tools/testing/selftests/bpf/test_progs.c | 577 +++++++++++++++++++++-- > tools/testing/selftests/bpf/test_progs.h | 36 +- > 2 files changed, 581 insertions(+), 32 deletions(-) > [...]