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