]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
selftests/bpf: Add parallelism to test_progs
authorYucong Sun <sunyucong@gmail.com>
Wed, 6 Oct 2021 18:56:06 +0000 (11:56 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 8 Oct 2021 21:37:56 +0000 (14:37 -0700)
commit91b2c0afd00cb01d715d6e9503624ab33580d5b6
treeb1b9c374bdedf416e249a224867c43eb58ea223e
parenta1852ce0e54251c977e92ca55476ef37bd08fb0e
selftests/bpf: Add parallelism to test_progs

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/SEQPACKET 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@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211006185619.364369-2-fallentree@fb.com
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h