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>
This commit is contained in:
Alessandro Gatti
2025-12-20 09:26:02 +01:00
parent 2b82f512d2
commit ecf8873293
2 changed files with 7 additions and 1 deletions

View File

@@ -164,6 +164,9 @@ QEMU_DEBUG_ARGS ?= -s
QEMU_ARGS += -S $(QEMU_DEBUG_ARGS) $(QEMU_DEBUG_EXTRA)
endif
# Allow selecting a subset of natmods to test.
TEST_NATMODS ?= btree deflate framebuf heapq random_basic re
INC += -I.
INC += -I$(TOP)
INC += -I$(BUILD)
@@ -265,7 +268,7 @@ test_full: $(BUILD)/firmware.elf
test_natmod: $(BUILD)/firmware.elf
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && \
for natmod in btree deflate framebuf heapq random_basic re; do \
for natmod in $(TEST_NATMODS); do \
./run-natmodtests.py -t execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_TESTS_EXTRA) extmod/$$natmod*.py; \
done

View File

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