lib: Add new 'counting cmap' type.
[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/ovn-controller \
156         tests/valgrind/ovn-nbctl \
157         tests/valgrind/ovn-northd \
158         tests/valgrind/ovn-sbctl \
159         tests/valgrind/ovs-appctl \
160         tests/valgrind/ovs-ofctl \
161         tests/valgrind/ovstest \
162         tests/valgrind/ovs-vsctl \
163         tests/valgrind/ovs-vswitchd \
164         tests/valgrind/ovsdb-client \
165         tests/valgrind/ovsdb-server \
166         tests/valgrind/ovsdb-tool \
167         tests/valgrind/test-aes128 \
168         tests/valgrind/test-atomic \
169         tests/valgrind/test-bundle \
170         tests/valgrind/test-byte-order \
171         tests/valgrind/test-classifier \
172         tests/valgrind/test-ccmap \
173         tests/valgrind/test-cmap \
174         tests/valgrind/test-csum \
175         tests/valgrind/test-flows \
176         tests/valgrind/test-hash \
177         tests/valgrind/test-hindex \
178         tests/valgrind/test-hmap \
179         tests/valgrind/test-json \
180         tests/valgrind/test-jsonrpc \
181         tests/valgrind/test-list \
182         tests/valgrind/test-lockfile \
183         tests/valgrind/test-multipath \
184         tests/valgrind/test-odp \
185         tests/valgrind/test-ofpbuf \
186         tests/valgrind/test-ovsdb \
187         tests/valgrind/test-packets \
188         tests/valgrind/test-random \
189         tests/valgrind/test-reconnect \
190         tests/valgrind/test-rstp \
191         tests/valgrind/test-sha1 \
192         tests/valgrind/test-stp \
193         tests/valgrind/test-type-props \
194         tests/valgrind/test-unix-socket \
195         tests/valgrind/test-unixctl \
196         tests/valgrind/test-uuid \
197         tests/valgrind/test-vconn
198
199 $(valgrind_wrappers): tests/valgrind-wrapper.in
200         @test -d tests/valgrind || mkdir tests/valgrind
201         $(AM_V_GEN) sed -e 's,[@]wrap_program[@],$@,' \
202                 $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp && \
203         chmod +x $@.tmp && \
204         mv $@.tmp $@
205 CLEANFILES += $(valgrind_wrappers)
206 EXTRA_DIST += tests/valgrind-wrapper.in
207
208 VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
209         --suppressions=$(abs_top_srcdir)/tests/glibc.supp \
210         --suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
211 EXTRA_DIST += tests/glibc.supp tests/openssl.supp
212 check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) \
213                 $(valgrind_wrappers) $(check_DATA)
214         $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
215         @echo
216         @echo '----------------------------------------------------------------------'
217         @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
218         @echo '----------------------------------------------------------------------'
219 \f
220 # OFTest support.
221
222 check-oftest: all
223         $(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-oftest
224 EXTRA_DIST += tests/run-oftest
225
226 # Ryu support.
227 check-ryu: all
228         $(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-ryu
229 EXTRA_DIST += tests/run-ryu
230 \f
231 # Run kmod tests. Assume kernel modules has been installed or linked into the kernel
232 check-kernel: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
233         $(SHELL) '$(SYSTEM_KMOD_TESTSUITE)' -C tests  AUTOTEST_PATH='$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
234
235 # Testing the out of tree Kernel module
236 check-kmod: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
237         $(MAKE) modules_install
238         modprobe -r -a vport-geneve vport-gre vport-lisp vport-stt vport-vxlan openvswitch
239         $(MAKE) check-kernel
240
241 check-system-userspace: all tests/atconfig tests/atlocal $(SYSTEM_USERSPACE_TESTSUITE)
242         $(SHELL) '$(SYSTEM_USERSPACE_TESTSUITE)' -C tests  AUTOTEST_PATH='$(AUTOTEST_PATH)' $(TESTSUITEFLAGS) -j1
243
244 clean-local:
245         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
246
247 AUTOTEST = $(AUTOM4TE) --language=autotest
248
249 if WIN32
250 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(COMMON_MACROS_AT) $(TESTSUITE_PATCH)
251         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o testsuite.tmp $@.at
252         patch -p0 testsuite.tmp $(TESTSUITE_PATCH)
253         $(AM_V_at)mv testsuite.tmp $@
254 else
255 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(COMMON_MACROS_AT)
256         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
257         $(AM_V_at)mv $@.tmp $@
258 endif
259
260 $(SYSTEM_KMOD_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_KMOD_TESTSUITE_AT) $(COMMON_MACROS_AT)
261         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
262         $(AM_V_at)mv $@.tmp $@
263
264 $(SYSTEM_USERSPACE_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_USERSPACE_TESTSUITE_AT) $(COMMON_MACROS_AT)
265         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
266         $(AM_V_at)mv $@.tmp $@
267
268 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
269 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
270         $(AM_V_GEN):;{ \
271           echo '# Signature of the current package.' && \
272           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
273           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
274           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
275           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
276           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
277         } >'$(srcdir)/package.m4'
278
279 noinst_PROGRAMS += tests/test-ovsdb
280 tests_test_ovsdb_SOURCES = tests/test-ovsdb.c
281 nodist_tests_test_ovsdb_SOURCES = tests/idltest.c tests/idltest.h
282 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
283 tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
284
285 noinst_PROGRAMS += tests/test-lib
286 tests_test_lib_SOURCES = \
287         tests/test-lib.c
288 tests_test_lib_LDADD = lib/libopenvswitch.la
289
290 # idltest schema and IDL
291 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
292 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
293 EXTRA_DIST += $(IDLTEST_IDL_FILES) tests/idltest2.ovsschema
294 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
295         $(AM_V_GEN)$(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp && \
296         mv $@.tmp $@
297
298 tests/idltest.c: tests/idltest.h
299
300 if DPDK_NETDEV
301 noinst_PROGRAMS += tests/test-dpdkr
302 tests_test_dpdkr_SOURCES = \
303         tests/dpdk/ring_client.c
304 tests_test_dpdkr_LDADD = lib/libopenvswitch.la $(LIBS)
305 endif
306
307 noinst_PROGRAMS += tests/ovstest
308 tests_ovstest_SOURCES = \
309         tests/ovstest.c \
310         tests/ovstest.h \
311         tests/test-aes128.c \
312         tests/test-atomic.c \
313         tests/test-bundle.c \
314         tests/test-byte-order.c \
315         tests/test-classifier.c \
316         tests/test-ccmap.c \
317         tests/test-cmap.c \
318         tests/test-csum.c \
319         tests/test-flows.c \
320         tests/test-hash.c \
321         tests/test-heap.c \
322         tests/test-hindex.c \
323         tests/test-hmap.c \
324         tests/test-json.c \
325         tests/test-jsonrpc.c \
326         tests/test-list.c \
327         tests/test-lockfile.c \
328         tests/test-multipath.c \
329         tests/test-netflow.c \
330         tests/test-odp.c \
331         tests/test-ofpbuf.c \
332         tests/test-ovn.c \
333         tests/test-packets.c \
334         tests/test-random.c \
335         tests/test-rcu.c \
336         tests/test-reconnect.c \
337         tests/test-rstp.c \
338         tests/test-sflow.c \
339         tests/test-sha1.c \
340         tests/test-stp.c \
341         tests/test-unixctl.c \
342         tests/test-util.c \
343         tests/test-uuid.c \
344         tests/test-bitmap.c \
345         tests/test-vconn.c \
346         tests/test-aa.c
347
348 if !WIN32
349 tests_ovstest_SOURCES += \
350         tests/test-unix-socket.c
351 endif
352
353 if LINUX
354 tests_ovstest_SOURCES += \
355         tests/test-netlink-conntrack.c
356 endif
357
358 tests_ovstest_LDADD = lib/libopenvswitch.la ovn/lib/libovn.la
359 dist_check_SCRIPTS = tests/flowgen.pl
360
361 noinst_PROGRAMS += tests/test-strtok_r
362 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
363
364 noinst_PROGRAMS += tests/test-type-props
365 tests_test_type_props_SOURCES = tests/test-type-props.c
366
367 # Python tests.
368 CHECK_PYFILES = \
369         tests/appctl.py \
370         tests/test-daemon.py \
371         tests/test-json.py \
372         tests/test-jsonrpc.py \
373         tests/test-l7.py \
374         tests/test-ovsdb.py \
375         tests/test-reconnect.py \
376         tests/MockXenAPI.py \
377         tests/test-unix-socket.py \
378         tests/test-unixctl.py \
379         tests/test-vlog.py
380 EXTRA_DIST += $(CHECK_PYFILES)
381 PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
382
383 FLAKE8_PYFILES += $(CHECK_PYFILES)
384
385 if HAVE_OPENSSL
386 TESTPKI_FILES = \
387         tests/testpki-cacert.pem \
388         tests/testpki-cert.pem \
389         tests/testpki-privkey.pem \
390         tests/testpki-req.pem \
391         tests/testpki-cert2.pem \
392         tests/testpki-privkey2.pem \
393         tests/testpki-req2.pem
394 check_DATA += $(TESTPKI_FILES)
395 CLEANFILES += $(TESTPKI_FILES)
396
397 tests/testpki-cacert.pem: tests/pki/stamp
398         $(AM_V_GEN)cp tests/pki/switchca/cacert.pem $@
399 tests/testpki-cert.pem: tests/pki/stamp
400         $(AM_V_GEN)cp tests/pki/test-cert.pem $@
401 tests/testpki-req.pem: tests/pki/stamp
402         $(AM_V_GEN)cp tests/pki/test-req.pem $@
403 tests/testpki-privkey.pem: tests/pki/stamp
404         $(AM_V_GEN)cp tests/pki/test-privkey.pem $@
405 tests/testpki-cert2.pem: tests/pki/stamp
406         $(AM_V_GEN)cp tests/pki/test2-cert.pem $@
407 tests/testpki-req2.pem: tests/pki/stamp
408         $(AM_V_GEN)cp tests/pki/test2-req.pem $@
409 tests/testpki-privkey2.pem: tests/pki/stamp
410         $(AM_V_GEN)cp tests/pki/test2-privkey.pem $@
411
412 OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
413 tests/pki/stamp:
414         $(AM_V_at)rm -f tests/pki/stamp
415         $(AM_V_at)rm -rf tests/pki
416         $(AM_V_GEN)$(OVS_PKI) init && \
417         $(OVS_PKI) req+sign tests/pki/test && \
418         $(OVS_PKI) req+sign tests/pki/test2 && \
419         : > tests/pki/stamp
420 CLEANFILES += tests/ovs-pki.log
421
422 CLEAN_LOCAL += clean-pki
423 clean-pki:
424         rm -f tests/pki/stamp
425         rm -rf tests/pki
426 endif