aboutsummaryrefslogtreecommitdiff
path: root/qemu-arm
diff options
context:
space:
mode:
authorDamien George2015-01-09 00:03:21 +0000
committerDamien George2015-01-09 00:03:21 +0000
commit85e8e2ed5b1954b042b2157a27c6f06090cd0511 (patch)
treec8239a22ff2ea633e63a6000030698dbe6fccdc8 /qemu-arm
parent3990dcfcd78017dfada57ff2ca61c2dbcf0b7074 (diff)
qemu-arm: Add 'test' target to Makefile to run and verify test suite.
Replaces RUN_TEST=1 definition; now "make test" in qemu-arm directory will run tests/basics/ and check that they all succeed. This patch also enables the test on Travis CI.
Diffstat (limited to 'qemu-arm')
-rw-r--r--qemu-arm/Makefile33
-rw-r--r--qemu-arm/mpconfigport.h4
2 files changed, 23 insertions, 14 deletions
diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile
index 232220969..0c09dd2ff 100644
--- a/qemu-arm/Makefile
+++ b/qemu-arm/Makefile
@@ -12,6 +12,7 @@ CROSS_COMPILE = arm-none-eabi-
INC = -I.
INC += -I..
INC += -I$(BUILD)
+INC += -I../tools/tinytest/
CFLAGS_CORTEX_M3 = -mthumb -mcpu=cortex-m3
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 $(CFLAGS_CORTEX_M3) $(COPT) \
@@ -33,15 +34,11 @@ endif
## - gcc-arm-none-eabi-4_8-2014q1/share/gcc-arm-none-eabi/samples/src/qemu/Makefile
LDFLAGS= --specs=nano.specs --specs=rdimon.specs -Wl,--gc-sections -Wl,-Map=$(@:.elf=.map)
-ifeq ($(RUN_TESTS), 1)
-SRC_C = \
- test_main.c \
-
-else
SRC_C = \
main.c \
-endif
+SRC_TEST_C = \
+ test_main.c \
SRC_S = \
@@ -50,15 +47,21 @@ OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
-ifeq ($(RUN_TESTS), 1)
-INC += -I../tools/tinytest/
-OBJ += $(BUILD)/tinytest.o
-endif
+OBJ_TEST =
+OBJ_TEST += $(PY_O)
+OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o))
+OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
+OBJ_TEST += $(BUILD)/tinytest.o
all: run
-run: $(BUILD)/flash.elf
- qemu-system-arm -cpu cortex-m3 -nographic -monitor null -serial null -semihosting -kernel $(BUILD)/flash.elf
+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
@@ -70,8 +73,12 @@ $(BUILD)/tinytest.o:
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c ../tools/tinytest/tinytest.c
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
-$(BUILD)/flash.elf: $(OBJ)
+$(BUILD)/firmware.elf: $(OBJ)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(Q)$(SIZE) $@
+$(BUILD)/firmware-test.elf: $(OBJ_TEST)
+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ_TEST) $(LIBS)
+ $(Q)$(SIZE) $@
+
include ../py/mkrules.mk
diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h
index 45c773741..32ed77c1d 100644
--- a/qemu-arm/mpconfigport.h
+++ b/qemu-arm/mpconfigport.h
@@ -12,8 +12,10 @@
#define MICROPY_HELPER_REPL (0)
#define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (0)
-#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
+#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
+#define MICROPY_PY_BUILTINS_FROZENSET (1)
+#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_IO (0)
// type definitions for the specific machine