summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-28 23:40:17 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-28 23:40:17 -0400
commitbfbb5cde5a7e629d80a58fc75f8c15b7c45e5503 (patch)
treee6e62d68e4da347f4fd7a7c2fc6f2d6dd487cfbf
parenta5068eae0d7a55ee5a5517d10fb235f8ca5a55da (diff)
put back test in qemu-arm build
-rw-r--r--ports/qemu-arm/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/ports/qemu-arm/Makefile b/ports/qemu-arm/Makefile
index 95f349beb..6c4a74620 100644
--- a/ports/qemu-arm/Makefile
+++ b/ports/qemu-arm/Makefile
@@ -91,9 +91,27 @@ all: run
run: $(BUILD)/firmware.elf
qemu-system-arm -machine integratorcp -cpu cortex-m3 -nographic -monitor null -serial null -semihosting -kernel $(BUILD)/firmware.elf
+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"
+
+.PHONY: $(BUILD)/genhdr/tests.h
+
+$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
+$(BUILD)/genhdr/tests.h:
+ $(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@
+
+$(BUILD)/tinytest.o:
+ $(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TOP)/tools/tinytest/tinytest.c
+
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
$(BUILD)/firmware.elf: $(OBJ_COMMON) $(OBJ_RUN)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
+$(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST)
+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(Q)$(SIZE) $@
+
include $(TOP)/py/mkrules.mk