qemu/Makefile: Fix shell interpolation for automated natmod tests.

This commit fixes the command used to run natmod tests, as it relied on
a string interpolation feature of the POSIX shell that was not working
as expected inside a makefile.

The interpolation was not performed from inside the makefile and the raw
command string was sent to the operating system for execution.  Now the
command is run by using a different type of string substitution, which
explicitly performs the interpolation using a POSIX shell for-loop.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti 2025-01-24 11:18:39 +01:00 committed by Damien George
parent dfd1d69a72
commit ca3090a33f

View file

@ -189,11 +189,14 @@ test_full: $(BUILD)/firmware.elf
cd $(TOP)/tests && ./run-tests.py $(RUN_TESTS_FULL_ARGS) --via-mpy
cd $(TOP)/tests && ./run-tests.py $(RUN_TESTS_FULL_ARGS) --via-mpy --emit native
# "btree" currently does not build for rv32imc (Picolibc TLS incompatibility).
.PHONY: test_natmod
test_natmod: $(BUILD)/firmware.elf
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
# "btree" cannot build against Picolibc right now.
cd $(TOP)/tests && ./run-natmodtests.py -p -d execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_NATMODTESTS_ARGS) extmod/{deflate,framebuf,heapq,random_basic,re}*.py
cd $(TOP)/tests && \
for natmod in deflate framebuf heapq random_basic re; do \
./run-natmodtests.py -p -d execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" extmod/$$natmod*.py; \
done
$(BUILD)/firmware.elf: $(LDSCRIPT) $(OBJ)
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)