summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-08-14 10:04:33 -0500
committerDamien George <damien@micropython.org>2025-09-16 12:31:14 +1000
commita69425b533932bbcac0ef463f9e27f79ff2150e3 (patch)
tree4b6c87bc12814cfe5099393ad197d3909a8e6e06
parente9da4c9c98c329c85eb7273437ff9e567d6cd006 (diff)
unix/Makefile: 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 <jepler@gmail.com>
-rw-r--r--ports/unix/Makefile20
-rw-r--r--ports/unix/README.md8
2 files changed, 27 insertions, 1 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index 4e9a3736a..e4638299f 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -254,12 +254,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 656d4303d..ee983a882 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