Skip to contentSkip to conversation

selftests/bpf: merge most of test_btf into test_progs

PATCH Applied Andrii Nakryiko 2 participants 2 messages Sep 16, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 selftests/bpf: merge most of test_btf into test_progs

Merge 183 tests from test_btf into test_progs framework to be exercised regularly. All the test_btf tests that were moved are modeled as proper sub-tests in test_progs framework for ease of debugging and reporting.

No functional or behavioral changes were intended, I tried to preserve original behavior as much as possible. E.g., test_progs -v will activate "always_log" flag to emit BTF validation log.

The only difference is in reducing the max_entries limit for pretty-printing tests from (128 * 1024) to just 128 to reduce tests running time without reducing the coverage.

Example test run:

  $ sudo ./test_progs -n 8
  ...
  #8 btf:OK
  Summary: 1/183 PASSED, 0 SKIPPED, 0 FAILED

---
v2->v3:
- made pprint use smaller max_entries (as suggested by Alexei) and then everything just worked within test_progs; I didn't bother to check why it was failing with bigger max_entries;
v1->v2:
- pretty-print BTF tests were renamed test_btf -> test_btf_pprint, which allowed GIT to detect that majority of test_btf code was moved into prog_tests/btf.c; so diff is much-much smaller;

 tools/testing/selftests/bpf/.gitignore        |   1 -
 tools/testing/selftests/bpf/Makefile          |   2 +-
 .../bpf/{test_btf.c => prog_tests/btf.c}      | 410 ++++--------------
 3 files changed, 78 insertions(+), 335 deletions(-)
 rename tools/testing/selftests/bpf/{test_btf.c => prog_tests/btf.c} (96%)
tools/testing/selftests/bpf/.gitignore +0 -1
index 9a0946ddb705..e8fed558b8b8 100644
@@ -15,7 +15,6 @@ test_sock
 test_sock_addr
 test_sock_fields
 urandom_read
-test_btf
 test_sockmap
 test_lirc_mode2_user
 get_cgroup_id_user
tools/testing/selftests/bpf/Makefile +1 -1
index 05798c2b5c67..d6f59b0518f5 100644
@@ -33,7 +33,7 @@ LDLIBS += -lcap -lelf -lz -lrt -lpthread
 # Order correspond to 'make run_tests' order
 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
 	test_verifier_log test_dev_cgroup test_tcpbpf_user \
-	test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \
+	test_sock test_sockmap get_cgroup_id_user test_socket_cookie \
 	test_cgroup_storage \
 	test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \
 	test_progs-no_alu32 \
tools/testing/selftests/bpf/prog_tests/btf.c renamed from tools/testing/selftests/bpf/test_btf.c +77 -333

707 lines not on this page · raw message

Signature · 1 line
2.24.1
#1 lore raw
Quoted 12 lines · Andrii Nakryiko

Merge 183 tests from test_btf into test_progs framework to be exercised regularly. All the test_btf tests that were moved are modeled as proper sub-tests in test_progs framework for ease of debugging and reporting.

No functional or behavioral changes were intended, I tried to preserve original behavior as much as possible. E.g., test_progs -v will activate "always_log" flag to emit BTF validation log.

The only difference is in reducing the max_entries limit for pretty-printing tests from (128 * 1024) to just 128 to reduce tests running time without reducing the coverage.

Quoted 8 lines

Example test run:

  $ sudo ./test_progs -n 8
  ...
  #8 btf:OK
  Summary: 1/183 PASSED, 0 SKIPPED, 0 FAILED

Applied. Thanks.

Now we have that rcu warn in bpf-next tree. I'll send bpf PR shortly to converge the trees.