summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2024-02-12 01:19:40 +0000
committerGitHub <noreply@github.com>2024-02-12 01:19:40 +0000
commit72ce2655aa4eb6bb6a84b1bca49d1a9a7d572faa (patch)
treec237f5a92384c79f2400ed921c6c285aeeae999b /Makefile
parent5c5ddeba40470bdc3ebce6b5888538c24e718365 (diff)
Fix unit test execution (#23048)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 15 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index ab30a17f58..78d1a372bc 100644
--- a/Makefile
+++ b/Makefile
@@ -337,24 +337,23 @@ define BUILD_TEST
337 endif 337 endif
338endef 338endef
339 339
340define LIST_TEST
341 include $(BUILDDEFS_PATH)/testlist.mk
342 FOUND_TESTS := $$(patsubst ./tests/%,%,$$(TEST_LIST))
343 $$(info $$(FOUND_TESTS))
344endef
345
340define PARSE_TEST 346define PARSE_TEST
341 TESTS := 347 TESTS :=
342 # list of possible targets, colon-delimited, to reassign to MAKE_TARGET and remove 348 TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
343 TARGETS := :clean: 349 TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
344 ifneq (,$$(findstring :$$(lastword $$(subst :, ,$$(RULE))):, $$(TARGETS)))
345 MAKE_TARGET := $$(lastword $$(subst :, ,$$(RULE)))
346 TEST_SUBPATH := $$(subst $$(eval) ,/,$$(wordlist 2, $$(words $$(subst :, ,$$(RULE))), _ $$(subst :, ,$$(RULE))))
347 else
348 MAKE_TARGET :=
349 TEST_SUBPATH := $$(subst :,/,$$(RULE))
350 endif
351 include $(BUILDDEFS_PATH)/testlist.mk 350 include $(BUILDDEFS_PATH)/testlist.mk
352 ifeq ($$(RULE),all) 351 ifeq ($$(TEST_NAME),all)
353 MATCHED_TESTS := $$(TEST_LIST) 352 MATCHED_TESTS := $$(TEST_LIST)
354 else 353 else
355 MATCHED_TESTS := $$(foreach TEST, $$(TEST_LIST),$$(if $$(findstring /$$(TEST_SUBPATH)/, $$(patsubst %,%/,$$(TEST))), $$(TEST),)) 354 MATCHED_TESTS := $$(foreach TEST, $$(TEST_LIST),$$(if $$(findstring x$$(TEST_NAME)x, x$$(patsubst ./tests/%,%,$$(TEST)x)), $$(TEST),))
356 endif 355 endif
357 $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(MAKE_TARGET)))) 356 $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
358endef 357endef
359 358
360 359
@@ -437,6 +436,10 @@ git-submodules: git-submodule
437list-keyboards: 436list-keyboards:
438 $(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' ' 437 $(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' '
439 438
439.PHONY: list-tests
440list-tests:
441 $(eval $(call LIST_TEST))
442
440.PHONY: generate-keyboards-file 443.PHONY: generate-keyboards-file
441generate-keyboards-file: 444generate-keyboards-file:
442 $(QMK_BIN) list-keyboards --no-resolve-defaults 445 $(QMK_BIN) list-keyboards --no-resolve-defaults