1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/unittests/Makefile
2014-06-24 21:07:20 +02:00

49 lines
1.2 KiB
Makefile

export APPLICATION = unittests
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
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
# Pull in `Makefile.include`s from the test suites:
-include $(UNIT_TESTS:%=$(RIOTBASE)/tests/unittests/%/Makefile.include)
DIRS += $(UNIT_TESTS)
BASELIBS += $(UNIT_TESTS:%=$(BINDIR)%.a)
include $(RIOTBASE)/Makefile.include
$(UNIT_TESTS): all
charCOMMA := ,
ifeq (, $(UNIT_TESTS))
CFLAGS += -DNO_TEST_SUITES
$(warning There was no test suite specified!)
else
CFLAGS += -DTEST_SUITES='$(subst $() $(),$(charCOMMA),$(UNIT_TESTS:tests-%=%))'
endif
test: SHELL=bash
test:
@exec 5>&1 && \
LOG=$$("$(MAKE)" -s term | tee >(cat - >&5)) && \
grep 'OK ([1-9][0-9]* tests)' <<< $${LOG} > /dev/null