2017-12-11 18:04:27 +00:00
|
|
|
LIB_SRC_C = lib/upytesthelper/upytesthelper.c
|
|
|
|
|
2019-08-19 01:59:27 +01:00
|
|
|
FROZEN_MPY_DIR ?= test-frzmpy
|
|
|
|
|
2017-12-11 18:04:27 +00:00
|
|
|
include Makefile
|
|
|
|
|
|
|
|
CFLAGS += -DTEST
|
|
|
|
|
|
|
|
.PHONY: $(BUILD)/genhdr/tests.h
|
|
|
|
|
|
|
|
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
|
|
|
|
$(BUILD)/genhdr/tests.h:
|
2019-08-19 01:59:27 +01:00
|
|
|
(cd $(TOP)/tests; ./run-tests --target=qemu-arm --write-exp)
|
2017-12-11 18:04:27 +00:00
|
|
|
$(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)
|
2018-09-24 03:09:28 +01:00
|
|
|
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2017-12-11 18:04:27 +00:00
|
|
|
$(Q)$(SIZE) $@
|
|
|
|
|
2019-08-19 01:59:27 +01:00
|
|
|
# Note: Using timeout(1) to handle cases where qemu hangs (e.g. this can happen with alignment errors).
|
2017-12-11 18:04:27 +00:00
|
|
|
test: $(BUILD)/firmware-test.elf
|
2019-08-19 01:59:27 +01:00
|
|
|
timeout --foreground -k 5s 30s qemu-system-arm -machine $(BOARD) $(QEMU_EXTRA) -nographic -monitor null -semihosting -kernel $< > $(BUILD)/console.out
|
2017-12-11 18:04:27 +00:00
|
|
|
$(Q)tail -n2 $(BUILD)/console.out
|
|
|
|
$(Q)tail -n1 $(BUILD)/console.out | grep -q "status: 0"
|