From d325558b56188ad07974d0caf7c72beec2fd5d05 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Aug 2025 10:04:33 -0500 Subject: [PATCH] unix: Add additional testing targets. These are convenience targets for running specific tests as a developer. They are more useful that invoking run-tests directly as they take account of the VARIANT= specified on the make command-line. For instance, you can run all tests matching the regular expression "int" with `make VARIANT=... test//int`. (the new targets are all documented in README.md) Signed-off-by: Jeff Epler --- ports/unix/Makefile | 20 +++++++++++++++++++- ports/unix/README.md | 8 ++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 3c54d156c3..485743ea19 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -256,12 +256,30 @@ endif include $(TOP)/py/mkrules.mk -.PHONY: test test_full_no_native test_full +.PHONY: test test_full_no_native test_full test//% test/% test-failures print-failures clean-failures test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py $(eval DIRNAME=ports/$(notdir $(CURDIR))) cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py +test//%: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py + $(eval DIRNAME=ports/$(notdir $(CURDIR))) + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -i "$*" + +test-failures: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py + $(eval DIRNAME=ports/$(notdir $(CURDIR))) + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --run-failures + +print-failures: + cd $(TOP)/tests && ./run-tests.py --print-failures + +clean-failures: + cd $(TOP)/tests && ./run-tests.py --clean-failures + +test/%: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py + $(eval DIRNAME=ports/$(notdir $(CURDIR))) + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -d "$*" + test_full_no_native: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py $(eval DIRNAME=ports/$(notdir $(CURDIR))) cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py diff --git a/ports/unix/README.md b/ports/unix/README.md index 656d4303d3..ee983a882c 100644 --- a/ports/unix/README.md +++ b/ports/unix/README.md @@ -72,6 +72,14 @@ To run the complete testsuite, use: $ make test +There are other make targets to interact with the testsuite: + + $ make test//int # Run all tests matching the pattern "int" + $ make test/ports/unix # Run all tests in ports/unix + $ make test-failures # Re-run only the failed tests + $ make print-failures # print the differences for failed tests + $ make clean-failures # delete the .exp and .out files from failed tests + The Unix port comes with a built-in package manager called `mip`, e.g.: $ ./build-standard/micropython -m mip install hmac