summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-27 18:01:59 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-27 21:57:49 +0300
commit1b963117fedf91e4bef97d75eb4e3e0b3b1e1dfd (patch)
tree2bccc6a05c75e0255f0cb2565261282a85bedcf3 /Makefile
parent42baa6cf43ab1da79887e74b9ad71379c13094f9 (diff)
downloadqmk_firmware-1b963117fedf91e4bef97d75eb4e3e0b3b1e1dfd.tar.gz
qmk_firmware-1b963117fedf91e4bef97d75eb4e3e0b3b1e1dfd.zip
Support for running and cleaning all tests
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index b7ef5f92a3..78bf50ed41 100644
--- a/Makefile
+++ b/Makefile
@@ -414,23 +414,29 @@ define BUILD_TEST
MAKE_VARS := TEST=$$(TEST_NAME)
MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD))
- TEST_EXECUTABLE := $$(TEST_DIR)/$$(TEST_NAME).elf
- TESTS += $$(TEST_NAME)
- TEST_MSG := $$(MSG_TEST)
- $$(TEST_NAME)_COMMAND := \
- printf "$$(TEST_MSG)\n"; \
- $$(TEST_EXECUTABLE); \
- if [ $$$$? -gt 0 ]; \
- then error_occured=1; \
- fi; \
- printf "\n";
+ ifneq ($$(MAKE_TARGET),clean)
+ TEST_EXECUTABLE := $$(TEST_DIR)/$$(TEST_NAME).elf
+ TESTS += $$(TEST_NAME)
+ TEST_MSG := $$(MSG_TEST)
+ $$(TEST_NAME)_COMMAND := \
+ printf "$$(TEST_MSG)\n"; \
+ $$(TEST_EXECUTABLE); \
+ if [ $$$$? -gt 0 ]; \
+ then error_occured=1; \
+ fi; \
+ printf "\n";
+ endif
endef
define PARSE_TEST
TESTS :=
TEST_NAME := $$(firstword $$(subst -, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE)))
- MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
+ ifeq ($$(TEST_NAME),all)
+ MATCHED_TESTS := $$(TEST_LIST)
+ else
+ MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
+ endif
$$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
endef
@@ -494,6 +500,11 @@ all-keyboards: allkb-allsp-allkm
.PHONY: all-keyboards-defaults
all-keyboards-defaults: allkb-allsp-default
+.PHONY: test
+test: test-all
+
+.PHONY: test-clean
+test-clean: test-all-clean
# Generate the version.h file
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")