Skip to content

Commit 77d802e

Browse files
author
Shuah Khan
committed
selftests: change lib.mk RUN_TESTS to take test list as an argument
Change lib.mk RUN_TESTS to take test list as an argument. This will allow it to be called from individual test makefiles to run additional tests that aren't suitable for a default kselftest run. As an example, timers test includes destructive tests that aren't included in the common run_tests target. Change times/Makefile to use RUN_TESTS call with destructive test list as an argument instead of using its own RUN_TESTS target. Signed-off-by: Shuah Khan <[email protected]>
1 parent 49b7364 commit 77d802e

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

tools/testing/selftests/lib.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
1212
all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
1313

1414
define RUN_TESTS
15-
@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
15+
@for TEST in $(1); do \
1616
BASENAME_TEST=`basename $$TEST`; \
1717
if [ ! -x $$BASENAME_TEST ]; then \
1818
echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
@@ -24,7 +24,7 @@ define RUN_TESTS
2424
endef
2525

2626
run_tests: all
27-
$(RUN_TESTS)
27+
$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_PROGS))
2828

2929
define INSTALL_RULE
3030
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \

tools/testing/selftests/timers/Makefile

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,8 @@ TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) rtctest_setdate
1515

1616
include ../lib.mk
1717

18-
define RUN_DESTRUCTIVE_TESTS
19-
@for TEST in $(DESTRUCTIVE_TESTS); do \
20-
BASENAME_TEST=`basename $$TEST`; \
21-
if [ ! -x $$BASENAME_TEST ]; then \
22-
echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
23-
echo "selftests: $$BASENAME_TEST [FAIL]"; \
24-
else \
25-
cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\
26-
fi; \
27-
done;
28-
endef
29-
3018
# these tests require escalated privileges
3119
# and may modify the system time or trigger
3220
# other behavior like suspend
3321
run_destructive_tests: run_tests
34-
$(RUN_DESTRUCTIVE_TESTS)
22+
$(call RUN_TESTS, $(DESTRUCTIVE_TESTS))

0 commit comments

Comments
 (0)