2014-05-05 21:54:10 +02:00
|
|
|
APPLICATION = unittests
|
2014-04-07 15:15:25 +02:00
|
|
|
include ../Makefile.tests_common
|
|
|
|
|
|
|
|
USEMODULE += embunit
|
|
|
|
|
|
|
|
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
|
|
|
|
|
|
|
|
ifeq ($(OUTPUT),XML)
|
|
|
|
CFLAGS += -DOUTPUT=OUTPUT_XML
|
|
|
|
USEMODULE += embunit_textui
|
|
|
|
else ifeq ($(OUTPUT),TEXT)
|
|
|
|
CFLAGS += -DOUTPUT=OUTPUT_TEXT
|
|
|
|
USEMODULE += embunit_textui
|
|
|
|
else ifeq ($(OUTPUT),COMPILER)
|
|
|
|
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
|
|
|
|
USEMODULE += embunit_textui
|
|
|
|
endif
|
|
|
|
|
2014-05-14 11:13:53 +02:00
|
|
|
ifeq (, $(filter tests-%, $(MAKECMDGOALS)))
|
|
|
|
UNIT_TESTS := $(shell find -mindepth 1 -maxdepth 1 -type d -name 'tests-*' -printf '%f ')
|
|
|
|
else
|
|
|
|
UNIT_TESTS := $(filter tests-%, $(MAKECMDGOALS))
|
|
|
|
endif
|
2014-04-07 15:15:25 +02:00
|
|
|
|
2014-05-18 16:17:02 +02:00
|
|
|
# Pull in `Makefile.include`s from the test suites:
|
|
|
|
-include $(UNIT_TESTS:%=$(RIOTBASE)/tests/unittests/%/Makefile.include)
|
|
|
|
|
2014-06-18 11:21:05 +02:00
|
|
|
DIRS += $(UNIT_TESTS)
|
|
|
|
BASELIBS += $(UNIT_TESTS:%=$(BINDIR)%.a)
|
2014-05-14 11:13:53 +02:00
|
|
|
|
2014-06-18 11:21:05 +02:00
|
|
|
include $(RIOTBASE)/Makefile.include
|
2014-05-14 11:13:53 +02:00
|
|
|
|
|
|
|
$(UNIT_TESTS): all
|
|
|
|
|
2014-05-14 12:21:20 +02:00
|
|
|
charCOMMA := ,
|
|
|
|
|
|
|
|
ifeq (, $(UNIT_TESTS))
|
|
|
|
CFLAGS += -DNO_TEST_SUITES
|
|
|
|
$(warning There was no test suite specified!)
|
|
|
|
else
|
2014-06-18 11:21:05 +02:00
|
|
|
CFLAGS += -DTEST_SUITES='$(subst $() $(),$(charCOMMA),$(UNIT_TESTS:tests-%=%))'
|
2014-05-14 12:21:20 +02:00
|
|
|
endif
|
2014-05-29 04:40:43 +02:00
|
|
|
|
|
|
|
test: SHELL=bash
|
|
|
|
test:
|
|
|
|
@exec 5>&1 && \
|
|
|
|
LOG=$$("$(MAKE)" -s term | tee >(cat - >&5)) && \
|
|
|
|
grep 'OK ([1-9][0-9]* tests)' <<< $${LOG} > /dev/null
|