Support for running and cleaning all tests

This commit is contained in:
Fred Sundvik 2016-08-27 18:01:59 +03:00
parent 42baa6cf43
commit 1b963117fe

View file

@ -414,6 +414,7 @@ define BUILD_TEST
MAKE_VARS := TEST=$$(TEST_NAME) MAKE_VARS := TEST=$$(TEST_NAME)
MAKE_MSG := $$(MSG_MAKE_TEST) MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD)) $$(eval $$(call BUILD))
ifneq ($$(MAKE_TARGET),clean)
TEST_EXECUTABLE := $$(TEST_DIR)/$$(TEST_NAME).elf TEST_EXECUTABLE := $$(TEST_DIR)/$$(TEST_NAME).elf
TESTS += $$(TEST_NAME) TESTS += $$(TEST_NAME)
TEST_MSG := $$(MSG_TEST) TEST_MSG := $$(MSG_TEST)
@ -424,13 +425,18 @@ define BUILD_TEST
then error_occured=1; \ then error_occured=1; \
fi; \ fi; \
printf "\n"; printf "\n";
endif
endef endef
define PARSE_TEST define PARSE_TEST
TESTS := TESTS :=
TEST_NAME := $$(firstword $$(subst -, ,$$(RULE))) TEST_NAME := $$(firstword $$(subst -, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE))) TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE)))
ifeq ($$(TEST_NAME),all)
MATCHED_TESTS := $$(TEST_LIST)
else
MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),)) MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
endif
$$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET)))) $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
endef endef
@ -494,6 +500,11 @@ all-keyboards: allkb-allsp-allkm
.PHONY: all-keyboards-defaults .PHONY: all-keyboards-defaults
all-keyboards-defaults: allkb-allsp-default all-keyboards-defaults: allkb-allsp-default
.PHONY: test
test: test-all
.PHONY: test-clean
test-clean: test-all-clean
# Generate the version.h file # 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") GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")