Introduce regression tests.

For now this is just a number of different configurations and a
makefile target, "make regressiontests", to build with them.
Further tests, e.g. using SimulAVR or the hostside simulator
to check actual behaviour of the firmware are welcome.
This commit is contained in:
Markus Hitter 2015-07-13 12:31:12 +02:00
parent bf3dd74f54
commit 1eb7e73273
6 changed files with 46 additions and 0 deletions

View File

@ -113,6 +113,7 @@ TARGET = $(PROGRAM).hex
# to keep this working and can take a shortcut: # to keep this working and can take a shortcut:
SOURCES = $(wildcard *.c) SOURCES = $(wildcard *.c)
CFLAGS = $(EXTRA_CFLAGS)
CFLAGS += -DF_CPU=$(F_CPU) CFLAGS += -DF_CPU=$(F_CPU)
CFLAGS += -DMCU_STR=\"$(MCU)\" CFLAGS += -DMCU_STR=\"$(MCU)\"
CFLAGS += -mmcu=$(MCU) CFLAGS += -mmcu=$(MCU)

View File

@ -44,6 +44,7 @@ SOURCES = $(wildcard *.c)
SIM_SOURCES = $(subst $(SIM_PATH)/,,$(wildcard $(SIM_PATH)/*.c)) SIM_SOURCES = $(subst $(SIM_PATH)/,,$(wildcard $(SIM_PATH)/*.c))
SOURCES := $(filter-out $(subst _sim.c,.c,$(SIM_SOURCES)),$(SOURCES)) $(SIM_SOURCES) SOURCES := $(filter-out $(subst _sim.c,.c,$(SIM_SOURCES)),$(SOURCES)) $(SIM_SOURCES)
CFLAGS = $(EXTRA_CFLAGS)
CFLAGS += -g -Wall -Wstrict-prototypes -Wno-format -Os $(DEFS) -std=gnu99 CFLAGS += -g -Wall -Wstrict-prototypes -Wno-format -Os $(DEFS) -std=gnu99
CFLAGS += -funsigned-char -funsigned-bitfields -fshort-enums -I.. -I. CFLAGS += -funsigned-char -funsigned-bitfields -fshort-enums -I.. -I.
CFLAGS += -DSIMULATOR -Wno-format -Wno-format-security CFLAGS += -DSIMULATOR -Wno-format -Wno-format-security

View File

@ -107,3 +107,29 @@ $(BUILDDIR)/%.bin: $(BUILDDIR)/%.elf
$(BUILDDIR)/%.sym: $(BUILDDIR)/%.elf $(BUILDDIR)/%.sym: $(BUILDDIR)/%.elf
@echo " SYM $@" @echo " SYM $@"
@$(OBJDUMP) -t $< | perl -ne 'BEGIN { printf " ADDR NAME SIZE\n"; } /([0-9a-f]+)\s+(\w+)\s+O\s+\.(bss|data)\s+([0-9a-f]+)\s+(\w+)/ && printf "0x%04x %-20s +%d\n", eval("0x$$1") & 0xFFFF, $$5, eval("0x$$4")' | sort -k1 > $@ @$(OBJDUMP) -t $< | perl -ne 'BEGIN { printf " ADDR NAME SIZE\n"; } /([0-9a-f]+)\s+(\w+)\s+O\s+\.(bss|data)\s+([0-9a-f]+)\s+(\w+)/ && printf "0x%04x %-20s +%d\n", eval("0x$$1") & 0xFFFF, $$5, eval("0x$$4")' | sort -k1 > $@
# Helpful tools.
.PHONY: regressiontests
# Try to catch regressions. Put here whatever test can help to detect these
# and can be automated enough to allow to run them with a simple
# "make regressiontests".
regressiontests:
# Generic Gen7 configuration.
$(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-gen7.h \
MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all
# Generic RAMPS configuration.
$(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-ramps.h \
MCU=atmega2560 F_CPU=16000000UL EXTRA_CFLAGS=-Werror all
# Generic Teensy2 configuration, which uses USB_SERIAL.
$(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-teensy2.h \
MCU=atmega32u4 F_CPU=16000000UL EXTRA_CFLAGS=-Werror all
# Don't forget the hostside simulator.
$(MAKE) -f Makefile-SIM all
@# Nonstandard builds go into a subdirectory of build/, see definition of
@# $(BUILDDIR) above. Let's clean that up on success.
rm -rf $(BUILDDIR)/testcases/ $(BUILDDIR)/sim/
@echo
@echo "All regression tests ran successfully, you're fine to commit now."

View File

@ -0,0 +1,6 @@
// Configuration for controller board.
#include "../config/board.gen7-v1.4.h"
// Configuration for printer board.
#include "../config/printer.wolfstrap.h"

View File

@ -0,0 +1,6 @@
// Configuration for controller board.
#include "../config/board.ramps-v1.3.h"
// Configuration for printer board.
#include "../config/printer.mendel.h"

View File

@ -0,0 +1,6 @@
// Configuration for controller board.
#include "../config/board.teensy-v2.0.h"
// Configuration for printer board.
#include "../config/printer.mendel.h"