Skip to content

Commit a69425b

Browse files
jeplerdpgeorge
authored andcommitted
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>
1 parent e9da4c9 commit a69425b

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

ports/unix/Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,30 @@ endif
254254

255255
include $(TOP)/py/mkrules.mk
256256

257-
.PHONY: test test_full_no_native test_full
257+
.PHONY: test test_full_no_native test_full test//% test/% test-failures print-failures clean-failures
258258

259259
test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
260260
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
261261
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py
262262

263+
test//%: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
264+
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
265+
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -i "$*"
266+
267+
test-failures: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
268+
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
269+
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --run-failures
270+
271+
print-failures:
272+
cd $(TOP)/tests && ./run-tests.py --print-failures
273+
274+
clean-failures:
275+
cd $(TOP)/tests && ./run-tests.py --clean-failures
276+
277+
test/%: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
278+
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
279+
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -d "$*"
280+
263281
test_full_no_native: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
264282
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
265283
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py

ports/unix/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ To run the complete testsuite, use:
7272

7373
$ make test
7474

75+
There are other make targets to interact with the testsuite:
76+
77+
$ make test//int # Run all tests matching the pattern "int"
78+
$ make test/ports/unix # Run all tests in ports/unix
79+
$ make test-failures # Re-run only the failed tests
80+
$ make print-failures # print the differences for failed tests
81+
$ make clean-failures # delete the .exp and .out files from failed tests
82+
7583
The Unix port comes with a built-in package manager called `mip`, e.g.:
7684

7785
$ ./build-standard/micropython -m mip install hmac

0 commit comments

Comments
 (0)