Skip to content

Commit ecf8873

Browse files
committed
qemu/Makefile: Allow overriding the test natmods list.
This commit modifies the QEMU port makefile to let the user provide their own list of natmods to test as part of "test_natmod". The makefile now will replace the list of natmods to test with the contents of the "TEST_NATMODS" command line variable, so if there's a specific subset of natmods causing problems test runs can be limited to that very subset. "TEST_NATMODS" accepts a whitespace-separated list of natmod names for which there are available matching tests in "tests/extmod" (eg. make test_natmod TEST_NATMODS="btree heapq"). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent 2b82f51 commit ecf8873

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

ports/qemu/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ QEMU_DEBUG_ARGS ?= -s
164164
QEMU_ARGS += -S $(QEMU_DEBUG_ARGS) $(QEMU_DEBUG_EXTRA)
165165
endif
166166

167+
# Allow selecting a subset of natmods to test.
168+
TEST_NATMODS ?= btree deflate framebuf heapq random_basic re
169+
167170
INC += -I.
168171
INC += -I$(TOP)
169172
INC += -I$(BUILD)
@@ -265,7 +268,7 @@ test_full: $(BUILD)/firmware.elf
265268
test_natmod: $(BUILD)/firmware.elf
266269
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
267270
cd $(TOP)/tests && \
268-
for natmod in btree deflate framebuf heapq random_basic re; do \
271+
for natmod in $(TEST_NATMODS); do \
269272
./run-natmodtests.py -t execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_TESTS_EXTRA) extmod/$$natmod*.py; \
270273
done
271274

ports/qemu/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,8 @@ The following options can be specified on the `make` command line:
167167
- `QEMU_DEBUG_ARGS`: defaults to `-s` (gdb on TCP port 1234), but can be overridden
168168
with different qemu gdb arguments.
169169
- `QEMU_DEBUG_EXTRA`: extra options to pass to qemu when `QEMU_DEBUG=1` is used.
170+
- `TEST_NATMODS`: pass an optional list of space-separated names of natmods to test,
171+
so only the given subset of example natmods will be used by `test_natmod` (for
172+
example, `make test_natmod TEST_NATMODS="btree heapq re"`).
170173
- `MICROPY_HEAP_SIZE`: pass in an optional value (in bytes) for overriding the GC
171174
heap size used by the port.

0 commit comments

Comments
 (0)