aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/lib.mk
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2019-04-24 16:12:32 -0700
committerShuah Khan <skhan@linuxfoundation.org>2019-04-25 13:14:38 -0600
commitbf66078235ca27062f5924ed6901f40becc4a1a4 (patch)
treee3f63a723fba72eeb66cc8f17cb56bb6e56f47f1 /tools/testing/selftests/lib.mk
parentselftests: Use runner.sh for emit targets (diff)
downloadlinux-dev-bf66078235ca27062f5924ed6901f40becc4a1a4.tar.xz
linux-dev-bf66078235ca27062f5924ed6901f40becc4a1a4.zip
selftests: Extract logic for multiple test runs
This moves the logic for running multiple tests into a single "run_many" function of runner.sh. Both "run_tests" and "emit_tests" are modified to use it. Summary handling is now controlled by the "per_test_logging" shell flag. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/lib.mk25
1 files changed, 8 insertions, 17 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 6b2d026a94ea..28b8ffedfdf1 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -67,19 +67,11 @@ endif
.ONESHELL:
define RUN_TESTS
- @export KSFT_TAP_LEVEL=`echo 1`; \
- test_num=`echo 0`; \
- . $(selfdir)/kselftest/runner.sh; \
- echo "TAP version 13"; \
- for TEST in $(1); do \
- BASENAME_TEST=`basename $$TEST`; \
- test_num=`echo $$test_num+1 | bc`; \
- if [ "X$(summary)" != "X" ]; then \
- logfile="/tmp/$$BASENAME_TEST"; \
- cat /dev/null > "$$logfile"; \
- fi; \
- run_one "$$BASENAME_TEST" "$$test_num"; \
- done;
+ @. $(selfdir)/kselftest/runner.sh; \
+ if [ "X$(summary)" != "X" ]; then \
+ per_test_logging=1; \
+ fi; \
+ run_many $(1)
endef
run_tests: all
@@ -117,12 +109,11 @@ else
endif
emit_tests:
- @test_num=`echo 0`; \
for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
BASENAME_TEST=`basename $$TEST`; \
- test_num=`echo $$test_num+1 | bc`; \
- echo "run_one \"$$BASENAME_TEST\" \"$$test_num\""; \
- done;
+ echo " \\"; \
+ echo -n " \"$$BASENAME_TEST\""; \
+ done; \
# define if isn't already. It is undefined in make O= case.
ifeq ($(RM),)