summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-21 16:29:54 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-27 21:57:49 +0300
commit6d7cd639a5e4503f00162c7cfa4bc7302b82c71c (patch)
tree77c21e7a32258aaa1e2c49dd4c44983510a78045
parentcfddec17d5a4ea2c3ce9afe0f15de3fa604dee63 (diff)
downloadqmk_firmware-6d7cd639a5e4503f00162c7cfa4bc7302b82c71c.tar.gz
qmk_firmware-6d7cd639a5e4503f00162c7cfa4bc7302b82c71c.zip
Basic framework for parsing test targets
-rw-r--r--Makefile16
-rw-r--r--quantum/serial_link/tests/testlist.mk6
-rw-r--r--testlist.mk13
3 files changed, 34 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index f78cca6c6f..16e90f8e49 100644
--- a/Makefile
+++ b/Makefile
@@ -224,6 +224,8 @@ define PARSE_RULE
# PARSE_ALL_KEYBOARDS
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkb),true)
$$(eval $$(call PARSE_ALL_KEYBOARDS))
+ else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,test),true)
+ $$(eval $$(call PARSE_TEST))
# If the rule starts with the name of a known keyboard, then continue
# the parsing from PARSE_KEYBOARD
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYBOARDS)),true)
@@ -396,6 +398,16 @@ define PARSE_ALL_KEYMAPS
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
endef
+define PARSE_TEST
+ 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),))
+ $$(info Test name $$(TEST_NAME))
+ $$(info Test target $$(TEST_TARGET))
+ $$(info $$(MATCHED_TESTS))
+endef
+
+
# Set the silent mode depending on if we are trying to compile multiple keyboards or not
# By default it's on in that case, but it can be overriden by specifying silent=false
# from the command line
@@ -459,4 +471,6 @@ all-keyboards-defaults: allkb-allsp-default
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
-$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h) \ No newline at end of file
+$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)
+
+include $(ROOT_DIR)/testlist.mk \ No newline at end of file
diff --git a/quantum/serial_link/tests/testlist.mk b/quantum/serial_link/tests/testlist.mk
new file mode 100644
index 0000000000..4a734b1e1c
--- /dev/null
+++ b/quantum/serial_link/tests/testlist.mk
@@ -0,0 +1,6 @@
+TEST_LIST +=\
+ serial_link_byte_stuffer\
+ serial_link_frame_router\
+ serial_link_frame_validator\
+ serial_link_transport\
+ serial_link_triple_buffered_object \ No newline at end of file
diff --git a/testlist.mk b/testlist.mk
new file mode 100644
index 0000000000..1884d6d3f6
--- /dev/null
+++ b/testlist.mk
@@ -0,0 +1,13 @@
+include $(ROOT_DIR)/quantum/serial_link/tests/testlist.mk
+
+define VALIDATE_TEST_LIST
+ ifneq ($1,)
+ ifeq ($$(findstring -,$1),-)
+ $$(error Test names can't contain '-', but '$1' does)
+ else
+ $$(eval $$(call VALIDATE_TEST_LIST,$$(firstword $2),$$(wordlist 2,9999,$2)))
+ endif
+ endif
+endef
+
+$(eval $(call VALIDATE_TEST_LIST,$(firstword $(TEST_LIST)),$(wordlist 2,9999,$(TEST_LIST)))) \ No newline at end of file