Fix unit test execution (#23048)

master
Joel Challis 2024-02-12 01:19:40 +00:00 committed by GitHub
parent 5c5ddeba40
commit 72ce2655aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 12 deletions

View File

@ -337,24 +337,23 @@ define BUILD_TEST
endif endif
endef endef
define LIST_TEST
include $(BUILDDEFS_PATH)/testlist.mk
FOUND_TESTS := $$(patsubst ./tests/%,%,$$(TEST_LIST))
$$(info $$(FOUND_TESTS))
endef
define PARSE_TEST define PARSE_TEST
TESTS := TESTS :=
# list of possible targets, colon-delimited, to reassign to MAKE_TARGET and remove TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
TARGETS := :clean: TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
ifneq (,$$(findstring :$$(lastword $$(subst :, ,$$(RULE))):, $$(TARGETS)))
MAKE_TARGET := $$(lastword $$(subst :, ,$$(RULE)))
TEST_SUBPATH := $$(subst $$(eval) ,/,$$(wordlist 2, $$(words $$(subst :, ,$$(RULE))), _ $$(subst :, ,$$(RULE))))
else
MAKE_TARGET :=
TEST_SUBPATH := $$(subst :,/,$$(RULE))
endif
include $(BUILDDEFS_PATH)/testlist.mk include $(BUILDDEFS_PATH)/testlist.mk
ifeq ($$(RULE),all) ifeq ($$(TEST_NAME),all)
MATCHED_TESTS := $$(TEST_LIST) MATCHED_TESTS := $$(TEST_LIST)
else else
MATCHED_TESTS := $$(foreach TEST, $$(TEST_LIST),$$(if $$(findstring /$$(TEST_SUBPATH)/, $$(patsubst %,%/,$$(TEST))), $$(TEST),)) MATCHED_TESTS := $$(foreach TEST, $$(TEST_LIST),$$(if $$(findstring x$$(TEST_NAME)x, x$$(patsubst ./tests/%,%,$$(TEST)x)), $$(TEST),))
endif endif
$$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(MAKE_TARGET)))) $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
endef endef
@ -437,6 +436,10 @@ git-submodules: git-submodule
list-keyboards: list-keyboards:
$(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' ' $(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' '
.PHONY: list-tests
list-tests:
$(eval $(call LIST_TEST))
.PHONY: generate-keyboards-file .PHONY: generate-keyboards-file
generate-keyboards-file: generate-keyboards-file:
$(QMK_BIN) list-keyboards --no-resolve-defaults $(QMK_BIN) list-keyboards --no-resolve-defaults