Makefiles: Add $(AM_V_GEN) annotations to clean up "make" output.
[cascardo/ovs.git] / tests / automake.mk
1 EXTRA_DIST += \
2         $(TESTSUITE_AT) \
3         $(TESTSUITE) \
4         tests/atlocal.in \
5         $(srcdir)/package.m4 \
6         $(srcdir)/tests/testsuite
7 TESTSUITE_AT = \
8         tests/testsuite.at \
9         tests/ovsdb-macros.at \
10         tests/library.at \
11         tests/heap.at \
12         tests/bundle.at \
13         tests/classifier.at \
14         tests/check-structs.at \
15         tests/daemon.at \
16         tests/daemon-py.at \
17         tests/ofp-actions.at \
18         tests/ofp-print.at \
19         tests/ofp-util.at \
20         tests/ofp-errors.at \
21         tests/ovs-ofctl.at \
22         tests/odp.at \
23         tests/multipath.at \
24         tests/bfd.at \
25         tests/cfm.at \
26         tests/lacp.at \
27         tests/learn.at \
28         tests/vconn.at \
29         tests/file_name.at \
30         tests/aes128.at \
31         tests/unixctl-py.at \
32         tests/uuid.at \
33         tests/json.at \
34         tests/jsonrpc.at \
35         tests/jsonrpc-py.at \
36         tests/tunnel.at \
37         tests/lockfile.at \
38         tests/reconnect.at \
39         tests/ovs-vswitchd.at \
40         tests/dpif-netdev.at \
41         tests/ofproto-dpif.at \
42         tests/bridge.at \
43         tests/vlan-splinters.at \
44         tests/ofproto-macros.at \
45         tests/ofproto.at \
46         tests/ovsdb.at \
47         tests/ovsdb-log.at \
48         tests/ovsdb-types.at \
49         tests/ovsdb-data.at \
50         tests/ovsdb-column.at \
51         tests/ovsdb-table.at \
52         tests/ovsdb-row.at \
53         tests/ovsdb-schema.at \
54         tests/ovsdb-condition.at \
55         tests/ovsdb-mutation.at \
56         tests/ovsdb-query.at \
57         tests/ovsdb-transaction.at \
58         tests/ovsdb-execution.at \
59         tests/ovsdb-trigger.at \
60         tests/ovsdb-tool.at \
61         tests/ovsdb-server.at \
62         tests/ovsdb-monitor.at \
63         tests/ovsdb-idl.at \
64         tests/ovs-vsctl.at \
65         tests/ovs-monitor-ipsec.at \
66         tests/ovs-xapi-sync.at \
67         tests/stp.at \
68         tests/rstp.at \
69         tests/interface-reconfigure.at \
70         tests/vlog.at \
71         tests/vtep-ctl.at
72 TESTSUITE = $(srcdir)/tests/testsuite
73 DISTCLEANFILES += tests/atconfig tests/atlocal
74
75 AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests
76
77 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
78         $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
79 \f
80 # Python Coverage support.
81 # Requires coverage.py http://nedbatchelder.com/code/coverage/.
82
83 COVERAGE = coverage
84 COVERAGE_FILE='$(abs_srcdir)/.coverage'
85 check-pycov: all tests/atconfig tests/atlocal $(TESTSUITE) clean-pycov
86         PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE) PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
87         @cd $(srcdir) && $(COVERAGE) combine && COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
88         @echo
89         @echo '----------------------------------------------------------------------'
90         @echo 'Annotated coverage source has the ",cover" extension.'
91         @echo '----------------------------------------------------------------------'
92         @echo
93         @COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) report
94 \f
95 # valgrind support
96
97 valgrind_wrappers = \
98         tests/valgrind/ovs-appctl \
99         tests/valgrind/ovs-ofctl \
100         tests/valgrind/ovstest \
101         tests/valgrind/ovs-vsctl \
102         tests/valgrind/ovs-vswitchd \
103         tests/valgrind/ovsdb-client \
104         tests/valgrind/ovsdb-server \
105         tests/valgrind/ovsdb-tool \
106         tests/valgrind/test-aes128 \
107         tests/valgrind/test-atomic \
108         tests/valgrind/test-bundle \
109         tests/valgrind/test-byte-order \
110         tests/valgrind/test-classifier \
111         tests/valgrind/test-cmap \
112         tests/valgrind/test-csum \
113         tests/valgrind/test-flows \
114         tests/valgrind/test-hash \
115         tests/valgrind/test-hindex \
116         tests/valgrind/test-hmap \
117         tests/valgrind/test-json \
118         tests/valgrind/test-jsonrpc \
119         tests/valgrind/test-list \
120         tests/valgrind/test-lockfile \
121         tests/valgrind/test-multipath \
122         tests/valgrind/test-odp \
123         tests/valgrind/test-ovsdb \
124         tests/valgrind/test-packets \
125         tests/valgrind/test-random \
126         tests/valgrind/test-reconnect \
127         tests/valgrind/test-rstp \
128         tests/valgrind/test-sha1 \
129         tests/valgrind/test-stp \
130         tests/valgrind/test-type-props \
131         tests/valgrind/test-unix-socket \
132         tests/valgrind/test-uuid \
133         tests/valgrind/test-vconn
134
135 $(valgrind_wrappers): tests/valgrind-wrapper.in
136         @test -d tests/valgrind || mkdir tests/valgrind
137         $(AM_V_GEN) sed -e 's,[@]wrap_program[@],$@,' \
138                 $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp && \
139         chmod +x $@.tmp && \
140         mv $@.tmp $@
141 CLEANFILES += $(valgrind_wrappers)
142 EXTRA_DIST += tests/valgrind-wrapper.in
143
144 VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
145         --suppressions=$(abs_top_srcdir)/tests/glibc.supp \
146         --suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
147 EXTRA_DIST += tests/glibc.supp tests/openssl.supp
148 check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) \
149                 $(valgrind_wrappers) $(check_DATA)
150         $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
151         @echo
152         @echo '----------------------------------------------------------------------'
153         @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
154         @echo '----------------------------------------------------------------------'
155 \f
156 # OFTest support.
157
158 check-oftest: all
159         $(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-oftest
160 EXTRA_DIST += tests/run-oftest
161
162 # Ryu support.
163 check-ryu: all
164         $(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-ryu
165 EXTRA_DIST += tests/run-ryu
166 \f
167 clean-local:
168         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
169
170 AUTOTEST = $(AUTOM4TE) --language=autotest
171 $(TESTSUITE): package.m4 $(TESTSUITE_AT)
172         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
173         $(AM_V_at)mv $@.tmp $@
174
175 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
176 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
177         $(AM_V_GEN):;{ \
178           echo '# Signature of the current package.' && \
179           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
180           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
181           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
182           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
183           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
184         } >'$(srcdir)/package.m4'
185
186 noinst_PROGRAMS += tests/test-ovsdb
187 tests_test_ovsdb_SOURCES = \
188         tests/test-ovsdb.c \
189         tests/idltest.c \
190         tests/idltest.h
191 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
192 tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
193
194 # idltest schema and IDL
195 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
196 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
197 EXTRA_DIST += $(IDLTEST_IDL_FILES)
198 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
199         $(AM_V_GEN)$(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp && \
200         mv $@.tmp $@
201
202 tests/idltest.c: tests/idltest.h
203
204 if DPDK_NETDEV
205 noinst_PROGRAMS += tests/ovsclient
206 tests_ovsclient_SOURCES = \
207         tests/ovs_client/ovs_client.c
208 tests_ovsclient_LDADD = lib/libopenvswitch.la $(LIBS)
209 endif
210
211 noinst_PROGRAMS += tests/ovstest
212 tests_ovstest_SOURCES = \
213         tests/ovstest.c \
214         tests/ovstest.h \
215         tests/test-aes128.c \
216         tests/test-atomic.c \
217         tests/test-bundle.c \
218         tests/test-byte-order.c \
219         tests/test-classifier.c \
220         tests/test-cmap.c \
221         tests/test-csum.c \
222         tests/test-flows.c \
223         tests/test-hash.c \
224         tests/test-heap.c \
225         tests/test-hindex.c \
226         tests/test-hmap.c \
227         tests/test-json.c \
228         tests/test-jsonrpc.c \
229         tests/test-list.c \
230         tests/test-lockfile.c \
231         tests/test-multipath.c \
232         tests/test-netflow.c \
233         tests/test-odp.c \
234         tests/test-packets.c \
235         tests/test-random.c \
236         tests/test-reconnect.c \
237         tests/test-rstp.c \
238         tests/test-sflow.c \
239         tests/test-sha1.c \
240         tests/test-stp.c \
241         tests/test-util.c \
242         tests/test-uuid.c \
243         tests/test-bitmap.c \
244         tests/test-vconn.c
245
246 if !WIN32
247 tests_ovstest_SOURCES += \
248         tests/test-unix-socket.c
249 endif
250
251 tests_ovstest_LDADD = lib/libopenvswitch.la
252 dist_check_SCRIPTS = tests/flowgen.pl
253
254 noinst_PROGRAMS += tests/test-strtok_r
255 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
256
257 noinst_PROGRAMS += tests/test-type-props
258 tests_test_type_props_SOURCES = tests/test-type-props.c
259
260 # Python tests.
261 CHECK_PYFILES = \
262         tests/appctl.py \
263         tests/test-daemon.py \
264         tests/test-json.py \
265         tests/test-jsonrpc.py \
266         tests/test-ovsdb.py \
267         tests/test-reconnect.py \
268         tests/MockXenAPI.py \
269         tests/test-unix-socket.py \
270         tests/test-unixctl.py \
271         tests/test-vlog.py
272 EXTRA_DIST += $(CHECK_PYFILES)
273 PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
274
275 if HAVE_OPENSSL
276 TESTPKI_FILES = \
277         tests/testpki-cacert.pem \
278         tests/testpki-cert.pem \
279         tests/testpki-privkey.pem \
280         tests/testpki-req.pem \
281         tests/testpki-cert2.pem \
282         tests/testpki-privkey2.pem \
283         tests/testpki-req2.pem
284 check_DATA += $(TESTPKI_FILES)
285 CLEANFILES += $(TESTPKI_FILES)
286
287 tests/testpki-cacert.pem: tests/pki/stamp
288         $(AM_V_GEN)cp tests/pki/switchca/cacert.pem $@
289 tests/testpki-cert.pem: tests/pki/stamp
290         $(AM_V_GEN)cp tests/pki/test-cert.pem $@
291 tests/testpki-req.pem: tests/pki/stamp
292         $(AM_V_GEN)cp tests/pki/test-req.pem $@
293 tests/testpki-privkey.pem: tests/pki/stamp
294         $(AM_V_GEN)cp tests/pki/test-privkey.pem $@
295 tests/testpki-cert2.pem: tests/pki/stamp
296         $(AM_V_GEN)cp tests/pki/test2-cert.pem $@
297 tests/testpki-req2.pem: tests/pki/stamp
298         $(AM_V_GEN)cp tests/pki/test2-req.pem $@
299 tests/testpki-privkey2.pem: tests/pki/stamp
300         $(AM_V_GEN)cp tests/pki/test2-privkey.pem $@
301
302 OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
303 tests/pki/stamp:
304         $(AM_V_at)rm -f tests/pki/stamp
305         $(AM_V_at)rm -rf tests/pki
306         $(AM_V_GEN)$(OVS_PKI) init && \
307         $(OVS_PKI) req+sign tests/pki/test && \
308         $(OVS_PKI) req+sign tests/pki/test2 && \
309         : > tests/pki/stamp
310 CLEANFILES += tests/ovs-pki.log
311
312 CLEAN_LOCAL += clean-pki
313 clean-pki:
314         rm -f tests/pki/stamp
315         rm -rf tests/pki
316 endif