On 9/10/21 11:53 AM, sunyucong@xxxxxxxxx wrote:
On Fri, Sep 10, 2021 at 2:28 PM Yonghong Song <yhs@xxxxxx> wrote:
On 9/9/21 12:35 PM, Yucong Sun 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/DGRAM 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.
Example output:
> ./test_progs -n 15-20 -j
[ 8.584709] bpf_testmod: loading out-of-tree module taints kernel.
Launching 2 workers.
[0]: Running test 15.
[1]: Running test 16.
[1]: Running test 17.
[1]: Running test 18.
[1]: Running test 19.
[1]: Running test 20.
[1]: worker exit.
[0]: worker exit.
#15 btf_dump:OK
#16 btf_endian:OK
#17 btf_map_in_map:OK
#18 btf_module:OK
#19 btf_skc_cls_ingress:OK
#20 btf_split:OK
Summary: 6/20 PASSED, 0 SKIPPED, 0 FAILED
I tried the patch with latest bpf-next and
https://lore.kernel.org/bpf/20210909215658.hgqkvxvtjrvdnrve@revolver/T/#u
to avoid kernel warning.
My commandline is ./test_progs -j
my env is a 4 cpu qemu.
It seems the test is stuck and cannot finish:
...
Still waiting for thread 0 (test 0).
Still waiting for thread 0 (test 0).
Still waiting for thread 0 (test 0).
Still waiting for thread 0 (test 0).
Still waiting for thread 0 (test 0).
[1]+ Stopped ./test_progs -j
Sorry, It seems I forgot to test without "-n" param, here is a
trivial patch that will make it work.
diff --git a/tools/testing/selftests/bpf/test_progs.c
b/tools/testing/selftests/bpf/test_progs.c
index 74c6ea45502d..dd7bb2bec4d4 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -780,7 +780,7 @@ void crash_handler(int signum)
backtrace_symbols_fd(bt, sz, STDERR_FILENO);
}
-int current_test_idx = -1;
+int current_test_idx = 0;
pthread_mutex_t current_test_lock;
struct test_result {
Indeed. With this change the './test_progs -j' finished
although I saw some test failures which is also mentioned
in the patch itself.
Cheers.