circuitpython/ports/qemu-arm/Makefile.test
Yonatan Goldschmidt 973f68780d qemu-arm: Add ldscript dependency in the final firmware.elf target.
So that the target is rebuilt if the linker script changes.
2019-11-15 10:25:48 +11:00

28 lines
967 B
Makefile

LIB_SRC_C = lib/upytesthelper/upytesthelper.c
FROZEN_MANIFEST ?= "freeze('test-frzmpy')"
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 --target=qemu-arm --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: $(LDSCRIPT) $(ALL_OBJ_TEST)
$(Q)$(LD) $(LDFLAGS) -o $@ $(ALL_OBJ_TEST) $(LIBS)
$(Q)$(SIZE) $@
# Note: Using timeout(1) to handle cases where qemu hangs (e.g. this can happen with alignment errors).
test: $(BUILD)/firmware-test.elf
timeout --foreground -k 5s 30s qemu-system-arm -machine $(BOARD) $(QEMU_EXTRA) -nographic -monitor null -semihosting -kernel $< > $(BUILD)/console.out
$(Q)tail -n2 $(BUILD)/console.out
$(Q)tail -n1 $(BUILD)/console.out | grep -q "status: 0"