2021-07-09 05:19:15 +01:00
|
|
|
LIB_SRC_C = shared/upytesthelper/upytesthelper.c
|
2017-12-11 18:04:27 +00:00
|
|
|
|
2019-10-10 13:49:37 +01:00
|
|
|
FROZEN_MANIFEST ?= "freeze('test-frzmpy')"
|
2019-08-19 01:59:27 +01:00
|
|
|
|
2017-12-11 18:04:27 +00:00
|
|
|
include Makefile
|
|
|
|
|
2021-05-25 13:16:08 +01:00
|
|
|
ifeq ($(BOARD),sabrelite)
|
|
|
|
# These don't work on Cortex-A9.
|
|
|
|
TESTS_EXCLUDE = inlineasm/asmdiv.py inlineasm/asmspecialregs.py
|
|
|
|
endif
|
|
|
|
|
2017-12-11 18:04:27 +00:00
|
|
|
CFLAGS += -DTEST
|
|
|
|
|
|
|
|
.PHONY: $(BUILD)/genhdr/tests.h
|
|
|
|
|
|
|
|
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
|
|
|
|
$(BUILD)/genhdr/tests.h:
|
2021-03-11 05:09:27 +00:00
|
|
|
(cd $(TOP)/tests; ./run-tests.py --target=qemu-arm --write-exp)
|
2021-05-25 13:16:08 +01:00
|
|
|
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py $(addprefix --exclude ,$(TESTS_EXCLUDE))) > $@
|
2017-12-11 18:04:27 +00:00
|
|
|
|
2019-12-17 02:18:08 +00:00
|
|
|
$(BUILD)/lib/tinytest/tinytest.o: CFLAGS += -DNO_FORKING
|
2017-12-11 18:04:27 +00:00
|
|
|
|
2019-11-11 10:51:23 +00:00
|
|
|
$(BUILD)/firmware-test.elf: $(LDSCRIPT) $(ALL_OBJ_TEST)
|
|
|
|
$(Q)$(LD) $(LDFLAGS) -o $@ $(ALL_OBJ_TEST) $(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"
|