diff options
| author | Joel Challis <git@zvecr.com> | 2024-02-12 01:19:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-12 01:19:40 +0000 |
| commit | 72ce2655aa4eb6bb6a84b1bca49d1a9a7d572faa (patch) | |
| tree | c237f5a92384c79f2400ed921c6c285aeeae999b /Makefile | |
| parent | 5c5ddeba40470bdc3ebce6b5888538c24e718365 (diff) | |
Fix unit test execution (#23048)
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 27 |
1 files changed, 15 insertions, 12 deletions
| @@ -337,24 +337,23 @@ define BUILD_TEST | |||
| 337 | endif | 337 | endif |
| 338 | endef | 338 | endef |
| 339 | 339 | ||
| 340 | define LIST_TEST | ||
| 341 | include $(BUILDDEFS_PATH)/testlist.mk | ||
| 342 | FOUND_TESTS := $$(patsubst ./tests/%,%,$$(TEST_LIST)) | ||
| 343 | $$(info $$(FOUND_TESTS)) | ||
| 344 | endef | ||
| 345 | |||
| 340 | define PARSE_TEST | 346 | define 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)))) |
| 358 | endef | 357 | endef |
| 359 | 358 | ||
| 360 | 359 | ||
| @@ -437,6 +436,10 @@ git-submodules: git-submodule | |||
| 437 | list-keyboards: | 436 | list-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 | ||
| 440 | list-tests: | ||
| 441 | $(eval $(call LIST_TEST)) | ||
| 442 | |||
| 440 | .PHONY: generate-keyboards-file | 443 | .PHONY: generate-keyboards-file |
| 441 | generate-keyboards-file: | 444 | generate-keyboards-file: |
| 442 | $(QMK_BIN) list-keyboards --no-resolve-defaults | 445 | $(QMK_BIN) list-keyboards --no-resolve-defaults |
