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