aboutsummaryrefslogtreecommitdiff
path: root/ports/qemu-arm/Makefile.test
blob: 6b7f1dc7ab46cd328c528a06d9436735d38bda81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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.py --target=qemu-arm --write-exp)
	$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@

$(BUILD)/lib/tinytest/tinytest.o: CFLAGS += -DNO_FORKING

$(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"