ea6bddbf81
The way tinytest was used in qemu-arm test target is that it didn't test much. MicroPython tests are based on matching the test output against reference output, but qemu-arm's implementation didn't do that, it effectively tested just that there was no exception during test execution. "upytesthelper" wrapper was introduce to fix it, so switch test implementation to use it. This requires passing different CFLAGS when building the firmware, so split out test-related parts to Makefile.test.
25 lines
807 B
Makefile
25 lines
807 B
Makefile
LIB_SRC_C = lib/upytesthelper/upytesthelper.c
|
|
|
|
include Makefile
|
|
|
|
CFLAGS += -DTEST
|
|
|
|
.PHONY: $(BUILD)/genhdr/tests.h
|
|
|
|
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
|
|
$(BUILD)/genhdr/tests.h:
|
|
(cd $(TOP)/tests; ./run-tests --write-exp)
|
|
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@
|
|
|
|
$(BUILD)/tinytest.o:
|
|
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TINYTEST)/tinytest.c
|
|
|
|
$(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST)
|
|
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
$(Q)$(SIZE) $@
|
|
|
|
test: $(BUILD)/firmware-test.elf
|
|
qemu-system-arm -machine integratorcp -cpu cortex-m3 -nographic -monitor null -serial null -semihosting -kernel $(BUILD)/firmware-test.elf > $(BUILD)/console.out
|
|
$(Q)tail -n2 $(BUILD)/console.out
|
|
$(Q)tail -n1 $(BUILD)/console.out | grep -q "status: 0"
|