aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/Makefile
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-10-22 15:32:26 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-10-25 14:45:46 -0700
commit8ea688e7f444f1830aa4b283e1364ab9d9bf42b5 (patch)
tree2833b1fbad1ec1bf187bddf43f55394d45f8e385 /tools/testing/selftests/bpf/Makefile
parentselftests/bpf: Normalize selftest entry points (diff)
downloadlinux-dev-8ea688e7f444f1830aa4b283e1364ab9d9bf42b5.tar.xz
linux-dev-8ea688e7f444f1830aa4b283e1364ab9d9bf42b5.zip
selftests/bpf: Support multiple tests per file
Revamp how test discovery works for test_progs and allow multiple test entries per file. Any global void function with no arguments and serial_test_ or test_ prefix is considered a test. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211022223228.99920-3-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/Makefile')
-rw-r--r--tools/testing/selftests/bpf/Makefile7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 498222543c37..ac47cf9760fc 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -421,10 +421,9 @@ ifeq ($($(TRUNNER_TESTS_DIR)-tests-hdr),)
$(TRUNNER_TESTS_DIR)-tests-hdr := y
$(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c
$$(call msg,TEST-HDR,$(TRUNNER_BINARY),$$@)
- $$(shell ( cd $(TRUNNER_TESTS_DIR); \
- echo '/* Generated header, do not edit */'; \
- ls *.c 2> /dev/null | \
- sed -e 's@\([^\.]*\)\.c@DEFINE_TEST(\1)@'; \
+ $$(shell (echo '/* Generated header, do not edit */'; \
+ sed -n -E 's/^void (serial_)?test_([a-zA-Z0-9_]+)\((void)?\).*/DEFINE_TEST(\2)/p' \
+ $(TRUNNER_TESTS_DIR)/*.c | sort ; \
) > $$@)
endif