1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/unittests/Makefile
René Kijewski 297bc52062 unittests: use subfolders for different tests
Unittests for e.g. different libraries can be put into
`tests/unittests/tests-XXX`, where `XXX` is your test suite.

If `unittests` is made with `make all` (or any explicit argument), then
all test suites get built. If you use `make tests-XXX tests-YYY …` then
only the test suites `XXX` and `YYY` get built.
2014-05-14 12:48:56 +02:00

37 lines
901 B
Makefile

export PROJECT = 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
include $(RIOTBASE)/Makefile.include
UNITTEST_LIBS := $(UNIT_TESTS:%=$(BINDIR)%.a)
all: $(UNITTEST_LIBS)
$(UNIT_TESTS): all
$(UNITTEST_LIBS): $(BINDIR)%.a:
"$(MAKE)" -C $(CURDIR)/$*
CFLAGS += $(shell echo $(UNIT_TESTS:tests-%=-DTEST_%_ENABLED) | tr a-z A-Z)
BASELIBS += $(UNITTEST_LIBS)