Skip to content

Commit

Permalink
selftests: change lib.mk RUN_TESTS to take test list as an argument
Browse files Browse the repository at this point in the history
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 <shuahkh@osg.samsung.com>
  • Loading branch information
Shuah Khan committed Aug 25, 2017
1 parent 49b7364 commit 77d802e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)

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

run_tests: all
$(RUN_TESTS)
$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_PROGS))

define INSTALL_RULE
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
Expand Down
14 changes: 1 addition & 13 deletions tools/testing/selftests/timers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,8 @@ TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) rtctest_setdate

include ../lib.mk

define RUN_DESTRUCTIVE_TESTS
@for TEST in $(DESTRUCTIVE_TESTS); do \
BASENAME_TEST=`basename $$TEST`; \
if [ ! -x $$BASENAME_TEST ]; then \
echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
echo "selftests: $$BASENAME_TEST [FAIL]"; \
else \
cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\
fi; \
done;
endef

# these tests require escalated privileges
# and may modify the system time or trigger
# other behavior like suspend
run_destructive_tests: run_tests
$(RUN_DESTRUCTIVE_TESTS)
$(call RUN_TESTS, $(DESTRUCTIVE_TESTS))

0 comments on commit 77d802e

Please sign in to comment.