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