Blame view

RIOT/tests/unittests/Makefile 6.79 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
  APPLICATION = unittests
  include ../Makefile.tests_common
  
  BOARD_INSUFFICIENT_MEMORY := airfy-beacon \
                               arduino-duemilanove \
                               arduino-mega2560 \
                               arduino-mkr1000 \
                               arduino-mkrzero \
                               arduino-uno \
                               arduino-zero \
                               b-l072z-lrwan1 \
                               calliope-mini \
                               cc2538dk \
                               cc2650-launchpad \
                               cc2650stk \
                               chronos \
                               ek-lm4f120xl \
                               limifrog-v1 maple-mini \
                               mbed_lpc1768 \
                               microbit \
                               msb-430 \
                               msb-430h \
                               nrf51dongle \
                               nrf6310 \
                               nucleo32-f031 \
                               nucleo32-f042 \
                               nucleo32-f303 \
                               nucleo32-l031 \
                               nucleo32-l432 \
                               nucleo-f030 \
                               nucleo-f070 \
                               nucleo-f072 \
                               nucleo-f091 \
                               nucleo-f103 \
                               nucleo-f302 \
                               nucleo-f334 \
                               nucleo-f410 \
                               nucleo-l053 \
                               nucleo-l073 \
                               nz32-sc151 \
                               opencm904 \
                               openmote \
                               openmote-cc2538 \
                               pba-d-01-kw2x \
                               pca10000 \
                               pca10005 \
                               remote-pa \
                               remote-reva \
                               remote-revb \
                               saml21-xpro \
                               samd21-xpro \
                               samr21-xpro \
                               seeeduino_arch-pro \
                               slwstk6220a \
                               sodaq-autonomo \
                               sodaq-explorer \
                               spark-core \
                               stm32f0discovery \
                               stm32f3discovery \
                               telosb \
                               waspmote-pro \
                               wsn430-v1_3b \
                               wsn430-v1_4 \
                               yunjia-nrf51822 z1
  
  USEMODULE += embunit
  
  ifeq (, $(filter tests-%, $(MAKECMDGOALS)))
    # the $(dir) Makefile function leaves a trailing slash after the directory
    # name, therefore we use patsubst instead.
    UNIT_TESTS := $(patsubst %/Makefile,%,$(wildcard tests-*/Makefile))
  else
    UNIT_TESTS := $(filter tests-%, $(MAKECMDGOALS))
  endif
  
  ARM7_BOARDS := msba2 avrextrem
  DISABLE_TEST_FOR_ARM7 := tests-relic tests-cpp_%
  
  ARM_CORTEX_M_BOARDS := airfy-beacon \
                         arduino-due \
                         arduino-mkr1000 \
                         arduino-mkrzero \
                         arduino-zero \
                         b-l072z-lrwan1 \
                         cc2538dk \
                         ek-lm4f120xl \
                         f4vi1 \
                         fox \
                         frdm-k64f \
                         iotlab-m3 \
                         limifrog-v1 \
                         mbed_lpc1768 \
                         msbiot \
                         mulle \
                         nrf51dongle \
                         nrf52840dk \
                         nrf6310 \
                         nucleo144-f303 \
                         nucleo144-f412 \
                         nucleo144-f429 \
                         nucleo144-f446 \
                         nucleo32-f031 \
                         nucleo32-f303 \
                         nucleo32-l031 \
                         nucleo32-l432 \
                         nucleo-f030 \
                         nucleo-f070 \
                         nucleo-f072 \
                         nucleo-f091 \
                         nucleo-f302 \
                         nucleo-f303 \
                         nucleo-f334 \
                         nucleo-f401 \
                         nucleo-f410 \
                         nucleo-f411 \
                         nucleo-l053 \
                         nucleo-l073 \
                         nucleo-l152 \
                         nucleo-l476 \
                         nz32-sc151 \
                         opencm904 \
                         openmote-cc2538 \
                         pba-d-01-kw2x \
                         pca10000 \
                         pca10005 \
                         remote \
                         samd21-xpro \
                         saml21-xpro \
                         samr21-xpro \
                         slwstk6220a \
                         sodaq-autonomo \
                         sodaq-explorer \
                         spark-core \
                         stm32f0discovery \
                         stm32f3discovery \
                         stm32f4discovery \
                         udoo \
                         yunjia-nrf51822
  
  DISABLE_TEST_FOR_ARM_CORTEX_M := tests-relic
  
  AVR_BOARDS := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
  DISABLE_TEST_FOR_AVR := tests-relic tests-cpp_%
  
  MSP430_BOARDS :=  chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1
  DISABLE_TEST_FOR_MSP430 := tests-relic tests-spiffs tests-cpp_%
  
  ifneq (, $(filter $(ARM7_BOARDS), $(BOARD)))
    UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_ARM7), $(UNIT_TESTS))
  endif
  
  ifneq (, $(filter $(ARM_CORTEX_M_BOARDS), $(BOARD)))
    UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_ARM_CORTEX_M), $(UNIT_TESTS))
  endif
  
  ifneq (, $(filter $(AVR_BOARDS), $(BOARD)))
    UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_AVR), $(UNIT_TESTS))
  endif
  
  ifneq (, $(filter $(MSP430_BOARDS), $(BOARD)))
    UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_MSP430), $(UNIT_TESTS))
  endif
  
  ifneq (,$(filter tests-cpp_%, $(UNIT_TESTS)))
    # We need to tell the build system to use the C++ compiler for linking
    export FEATURES_REQUIRED += cpp
    export CPPMIX := 1
  endif
  
  DISABLE_MODULE += auto_init
  
  # 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)
  
  INCLUDES += -I$(RIOTBASE)/tests/unittests/common
  
  include $(RIOTBASE)/Makefile.include
  
  .PHONY: $(UNIT_TESTS)
  
  all:
  
  $(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:
  	./tests/01-run.py