From: Akos Kiss Date: Sat, 10 Oct 2020 20:54:36 +0000 (+0200) Subject: Test-related maintenance X-Git-Tag: v1.7~9^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=82bc763e5e3939ce2ee376d2f66905ae63a1c8ba;p=sx%2Fsimavr.git Test-related maintenance - Ensure that make reports an error if any of the tests fail - Don't duplicate compilation commands only for the sake of verbosity control - Simplify recipe for .tst files - Drop outdated and unnecessary .gitignore from tests directory - Add the execution of tests to Travis CI --- diff --git a/.travis.yml b/.travis.yml index c402827..3216af6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,6 @@ before_install: - sudo apt-get install -qq libelf-dev gcc-avr avr-libc freeglut3-dev language: c -script: make V=1 - +script: +- make V=1 +- make -C tests run_tests V=1 diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index 4147506..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -test_atmega48_disabled_timer -test_atmega48_enabled_timer -test_atmega48_watchdog_test -test_atmega644_adc_test -test_atmega88_example -test_atmega88_timer16 -test_atmega88_uart_echo diff --git a/tests/Makefile b/tests/Makefile index 5185342..38f492c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2,7 +2,7 @@ # This makefile takes each "at*" file, extracts it's part name # And compiles it into an ELF binary. # It also disassembles it for debugging purposes. -# +# # Copyright 2008-2012 Michel Pollet # # This file is part of simavr. @@ -28,24 +28,20 @@ IPATH += ${simavr}/simavr/sim tests_src := ${wildcard test_*.c} -all: obj axf tests +all: obj axf tst include ../Makefile.common -tests := ${patsubst %.c, ${OBJ}/%.tst, ${tests_src}} +tst: ${patsubst %.c, ${OBJ}/%.tst, ${tests_src}} -tests: ${tests} - axf: ${sources:.c=.axf} - + ${OBJ}/%.tst: tests.c %.c -ifeq ($(V),1) - $(CC) -MMD ${CPPFLAGS} ${CFLAGS} ${LFLAGS} -o $@ ${patsubst %.h,, ${^}} $(LDFLAGS) -else +ifneq ($(E),) @echo TST $@ - @$(CC) -MMD ${CPPFLAGS} ${CFLAGS} ${LFLAGS} -o $@ ${patsubst %.h,, ${^}} $(LDFLAGS) endif + ${E}$(CC) -MMD ${CPPFLAGS} ${CFLAGS} ${LFLAGS} -o $@ ${patsubst %.h,, ${^}} $(LDFLAGS) run_tests: all @export LD_LIBRARY_PATH=${simavr}/simavr/${OBJ} ;\ @@ -58,7 +54,8 @@ run_tests: all num_failed=$$(($$num_failed+1)) ;\ fi ;\ done ;\ - echo "Tests run: $$num_run Successes: $$(($$num_run-$$num_failed)) Failures: $$num_failed" + echo "Tests run: $$num_run Successes: $$(($$num_run-$$num_failed)) Failures: $$num_failed" ;\ + exit $$num_failed clean: clean-${OBJ} rm -f *.axf *.vcd