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 <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-08-14 10:04:33 -05:00
parent e25d545090
commit d325558b56
2 changed files with 27 additions and 1 deletions

View file

@ -256,12 +256,30 @@ endif
include $(TOP)/py/mkrules.mk 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 test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py 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 test_full_no_native: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py

View file

@ -72,6 +72,14 @@ To run the complete testsuite, use:
$ make test $ 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.: The Unix port comes with a built-in package manager called `mip`, e.g.:
$ ./build-standard/micropython -m mip install hmac $ ./build-standard/micropython -m mip install hmac