2014-05-05 21:54:10 +02:00
|
|
|
APPLICATION = unittests
|
2014-04-07 15:15:25 +02:00
|
|
|
include ../Makefile.tests_common
|
|
|
|
|
2014-08-08 19:21:03 +02:00
|
|
|
BOARD_INSUFFICIENT_RAM := chronos msb-430 msb-430h redbee-econotag stm32f0discovery \
|
|
|
|
telosb wsn430-v1_3b wsn430-v1_4 z1
|
2014-07-14 21:40:04 +02:00
|
|
|
|
2014-04-07 15:15:25 +02:00
|
|
|
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-08-08 19:21:03 +02:00
|
|
|
# Some randomly generated but still deterministic values for testing
|
|
|
|
CFLAGS += -DTEST_STRING8="\"o<\\\\rrB/q\""
|
|
|
|
CFLAGS += -DTEST_STRING12="\"50U'HLKC3_ft\""
|
|
|
|
CFLAGS += -DTEST_STRING16="\"nvxuO*6o3C=a6g7]\""
|
|
|
|
CFLAGS += -DTEST_STRING64="\"3key9'=4\\\\wvAM&;.E&U/rOG:>\\\\C!r{K k.E[%;(}_I(D%XQk8+T>_M^G'Mm49,n:))]}\""
|
|
|
|
CFLAGS += -DTEST_INT8=-69
|
|
|
|
CFLAGS += -DTEST_INT16=-12229
|
|
|
|
CFLAGS += -DTEST_INT32=-1894529023L
|
|
|
|
CFLAGS += -DTEST_INT64=-4562349816927799244LL
|
|
|
|
CFLAGS += -DTEST_UINT8=95U
|
|
|
|
CFLAGS += -DTEST_UINT16=10098U
|
|
|
|
CFLAGS += -DTEST_UINT32=2831907245LU
|
|
|
|
CFLAGS += -DTEST_UINT64=13500266397057512199LLU
|
|
|
|
|
2014-05-14 11:13:53 +02:00
|
|
|
ifeq (, $(filter tests-%, $(MAKECMDGOALS)))
|
2014-09-08 11:56:01 +02:00
|
|
|
UNIT_TESTS := $(foreach d,$(wildcard tests-*/Makefile),$(shell dirname $(d)))
|
2014-05-14 11:13:53 +02:00
|
|
|
else
|
|
|
|
UNIT_TESTS := $(filter tests-%, $(MAKECMDGOALS))
|
|
|
|
endif
|
2014-04-07 15:15:25 +02:00
|
|
|
|
2014-08-21 20:45:36 +02:00
|
|
|
DISABLE_MODULE += auto_init
|
|
|
|
|
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-08-08 13:48:14 +02:00
|
|
|
ifneq (,$(filter netdev_dummy,$(USEMODULE)))
|
|
|
|
USEMODULE += netdev_base
|
|
|
|
DIRS += netdev_dummy
|
|
|
|
INCLUDES += -I$(RIOTBASE)/tests/unittests/netdev_dummy/include
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
|
2014-08-08 19:21:03 +02:00
|
|
|
ifeq (,$(filter msp430x16x,$(CPU)))
|
|
|
|
CFLAGS += -DTEST_INT=TEST_INT32
|
|
|
|
else
|
|
|
|
CFLAGS += -DTEST_INT=TEST_INT16
|
|
|
|
endif
|
|
|
|
|
2014-08-27 14:04:22 +02:00
|
|
|
.PHONY: FORCE $(UNIT_TESTS)
|
|
|
|
|
|
|
|
FORCE:
|
|
|
|
touch $(CURDIR)/main.c
|
|
|
|
|
|
|
|
all: FORCE
|
|
|
|
|
|
|
|
$(UNIT_TESTS): FORCE all
|
2014-05-14 11:13:53 +02:00
|
|
|
|
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
|