]> git.proxmox.com Git - ovs.git/blame - tests/automake.mk
Replace most uses of assert by ovs_assert.
[ovs.git] / tests / automake.mk
CommitLineData
1b233b95
BP
1EXTRA_DIST += \
2 $(TESTSUITE_AT) \
3 $(TESTSUITE) \
4 tests/atlocal.in \
5 $(srcdir)/package.m4 \
6 $(srcdir)/tests/testsuite
7TESTSUITE_AT = \
8 tests/testsuite.at \
24c8ae53 9 tests/ovsdb-macros.at \
1b233b95 10 tests/library.at \
95974447 11 tests/heap.at \
daff3353 12 tests/bundle.at \
3223e977 13 tests/classifier.at \
05b3c97b 14 tests/check-structs.at \
ff8decf1 15 tests/daemon.at \
99155935 16 tests/daemon-py.at \
f25d0cf3 17 tests/ofp-actions.at \
fec00620 18 tests/ofp-print.at \
681ea7a0 19 tests/ofp-util.at \
2e0525bc 20 tests/ofp-errors.at \
0e581146 21 tests/ovs-ofctl.at \
3bffc610 22 tests/odp.at \
53ddd40a 23 tests/multipath.at \
f8064ac9 24 tests/autopath.at \
742468d9 25 tests/lacp.at \
75a75043 26 tests/learn.at \
d27ce529 27 tests/vconn.at \
e1aff6f9 28 tests/file_name.at \
d918d9d1 29 tests/aes128.at \
0a68ffd2 30 tests/unixctl-py.at \
d918d9d1 31 tests/uuid.at \
f38b84ea 32 tests/json.at \
f2129093 33 tests/jsonrpc.at \
99155935 34 tests/jsonrpc-py.at \
e7cfedd6 35 tests/timeval.at \
ac718c9d 36 tests/lockfile.at \
3ed497fc 37 tests/reconnect.at \
29901626 38 tests/ofproto-dpif.at \
0fbc9f11 39 tests/ofproto-macros.at \
a2cb9dfd 40 tests/ofproto.at \
f85f8ebb 41 tests/ovsdb.at \
41709ccc 42 tests/ovsdb-log.at \
f85f8ebb
BP
43 tests/ovsdb-types.at \
44 tests/ovsdb-data.at \
45 tests/ovsdb-column.at \
46 tests/ovsdb-table.at \
47 tests/ovsdb-row.at \
0d0f05b9 48 tests/ovsdb-schema.at \
f85f8ebb 49 tests/ovsdb-condition.at \
e9f8f936 50 tests/ovsdb-mutation.at \
f85f8ebb
BP
51 tests/ovsdb-query.at \
52 tests/ovsdb-transaction.at \
53 tests/ovsdb-execution.at \
54 tests/ovsdb-trigger.at \
1e19e50e 55 tests/ovsdb-tool.at \
21ff1aee 56 tests/ovsdb-server.at \
a8425c53 57 tests/ovsdb-monitor.at \
c3bb4bd7 58 tests/ovsdb-idl.at \
48d014bf 59 tests/ovs-vsctl.at \
b54bdbe9 60 tests/ovs-monitor-ipsec.at \
1b0fdca5 61 tests/ovs-xapi-sync.at \
829a7d02 62 tests/stp.at \
8ed182d8
EJ
63 tests/interface-reconfigure.at \
64 tests/vlog.at
1b233b95 65TESTSUITE = $(srcdir)/tests/testsuite
7fe079c2 66DISTCLEANFILES += tests/atconfig tests/atlocal
1b233b95 67
7c126fbb
BP
68AUTOTEST_PATH = utilities:vswitchd:ovsdb:tests
69
1b233b95 70check-local: tests/atconfig tests/atlocal $(TESTSUITE)
7c126fbb
BP
71 $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
72\f
79982e90
EJ
73# Python Coverage support.
74# Requires coverage.py http://nedbatchelder.com/code/coverage/.
75
76COVERAGE = coverage
77COVERAGE_FILE='$(abs_srcdir)/.coverage'
78check-pycov: all tests/atconfig tests/atlocal $(TESTSUITE) clean-pycov
853d1083 79 PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE) PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
79982e90
EJ
80 @cd $(srcdir) && $(COVERAGE) combine && COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
81 @echo
82 @echo '----------------------------------------------------------------------'
83 @echo 'Annotated coverage source has the ",cover" extension.'
84 @echo '----------------------------------------------------------------------'
85 @echo
86 @COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) report
87\f
b6fa4447
BP
88# valgrind support
89
90valgrind_wrappers = \
91 tests/valgrind/ovs-appctl \
9f19a2a3 92 tests/valgrind/ovs-ofctl \
b6fa4447 93 tests/valgrind/ovs-vsctl \
b0f7b9b5 94 tests/valgrind/ovs-vswitchd \
b6fa4447
BP
95 tests/valgrind/ovsdb-client \
96 tests/valgrind/ovsdb-server \
97 tests/valgrind/ovsdb-tool \
98 tests/valgrind/test-aes128 \
daff3353 99 tests/valgrind/test-bundle \
10a24935 100 tests/valgrind/test-byte-order \
b6fa4447
BP
101 tests/valgrind/test-classifier \
102 tests/valgrind/test-csum \
e1aff6f9 103 tests/valgrind/test-file_name \
b6fa4447
BP
104 tests/valgrind/test-flows \
105 tests/valgrind/test-hash \
95974447 106 tests/valgrind/test-heap \
b6fa4447
BP
107 tests/valgrind/test-hmap \
108 tests/valgrind/test-json \
109 tests/valgrind/test-jsonrpc \
110 tests/valgrind/test-list \
111 tests/valgrind/test-lockfile \
53ddd40a 112 tests/valgrind/test-multipath \
3bffc610 113 tests/valgrind/test-odp \
b6fa4447 114 tests/valgrind/test-ovsdb \
f696f12f 115 tests/valgrind/test-packets \
78f3f316 116 tests/valgrind/test-random \
b6fa4447
BP
117 tests/valgrind/test-reconnect \
118 tests/valgrind/test-sha1 \
829a7d02 119 tests/valgrind/test-stp \
b6fa4447
BP
120 tests/valgrind/test-timeval \
121 tests/valgrind/test-type-props \
6e170b4c 122 tests/valgrind/test-unix-socket \
b6fa4447 123 tests/valgrind/test-uuid \
10a24935 124 tests/valgrind/test-vconn
b6fa4447
BP
125
126$(valgrind_wrappers): tests/valgrind-wrapper.in
127 @test -d tests/valgrind || mkdir tests/valgrind
128 sed -e 's,[@]wrap_program[@],$@,' \
129 $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp
130 chmod +x $@.tmp
131 mv $@.tmp $@
132CLEANFILES += $(valgrind_wrappers)
133EXTRA_DIST += tests/valgrind-wrapper.in
134
135VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
75b87ae5 136 --suppressions=$(abs_top_srcdir)/tests/glibc.supp \
b6fa4447 137 --suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
75b87ae5 138EXTRA_DIST += tests/glibc.supp tests/openssl.supp
16496eea
BP
139check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) \
140 $(valgrind_wrappers) $(check_DATA)
b6fa4447
BP
141 $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
142 @echo
143 @echo '----------------------------------------------------------------------'
144 @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
145 @echo '----------------------------------------------------------------------'
146\f
1b233b95
BP
147clean-local:
148 test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
149
1b233b95
BP
150AUTOTEST = $(AUTOM4TE) --language=autotest
151$(TESTSUITE): package.m4 $(TESTSUITE_AT)
152 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
153 mv $@.tmp $@
154
155# The `:;' works around a Bash 3.2 bug when the output is not writeable.
156$(srcdir)/package.m4: $(top_srcdir)/configure.ac
157 :;{ \
158 echo '# Signature of the current package.' && \
f99cd6ee
BP
159 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
160 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
161 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
162 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
163 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
1b233b95
BP
164 } >'$(srcdir)/package.m4'
165
d918d9d1
BP
166noinst_PROGRAMS += tests/test-aes128
167tests_test_aes128_SOURCES = tests/test-aes128.c
bde9f75d 168tests_test_aes128_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
d918d9d1 169
daff3353
EJ
170noinst_PROGRAMS += tests/test-bundle
171tests_test_bundle_SOURCES = tests/test-bundle.c
bde9f75d 172tests_test_bundle_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
daff3353 173
064af421
BP
174noinst_PROGRAMS += tests/test-classifier
175tests_test_classifier_SOURCES = tests/test-classifier.c
bde9f75d 176tests_test_classifier_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
064af421 177
21effc03
BP
178noinst_PROGRAMS += tests/test-csum
179tests_test_csum_SOURCES = tests/test-csum.c
bde9f75d 180tests_test_csum_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
21effc03 181
e1aff6f9
BP
182noinst_PROGRAMS += tests/test-file_name
183tests_test_file_name_SOURCES = tests/test-file_name.c
bde9f75d 184tests_test_file_name_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
29d4af60 185
064af421
BP
186noinst_PROGRAMS += tests/test-flows
187tests_test_flows_SOURCES = tests/test-flows.c
bde9f75d 188tests_test_flows_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
1b233b95 189dist_check_SCRIPTS = tests/flowgen.pl
064af421 190
064af421
BP
191noinst_PROGRAMS += tests/test-hash
192tests_test_hash_SOURCES = tests/test-hash.c
193tests_test_hash_LDADD = lib/libopenvswitch.a
194
95974447
BP
195noinst_PROGRAMS += tests/test-heap
196tests_test_heap_SOURCES = tests/test-heap.c
bde9f75d 197tests_test_heap_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
95974447 198
064af421
BP
199noinst_PROGRAMS += tests/test-hmap
200tests_test_hmap_SOURCES = tests/test-hmap.c
bde9f75d 201tests_test_hmap_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
064af421 202
f38b84ea
BP
203noinst_PROGRAMS += tests/test-json
204tests_test_json_SOURCES = tests/test-json.c
bde9f75d 205tests_test_json_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
f38b84ea 206
f2129093
BP
207noinst_PROGRAMS += tests/test-jsonrpc
208tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
9467fe62 209tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
f2129093 210
064af421
BP
211noinst_PROGRAMS += tests/test-list
212tests_test_list_SOURCES = tests/test-list.c
cb22974d 213tests_test_list_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
064af421 214
ac718c9d
BP
215noinst_PROGRAMS += tests/test-lockfile
216tests_test_lockfile_SOURCES = tests/test-lockfile.c
bde9f75d 217tests_test_lockfile_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
ac718c9d 218
53ddd40a
BP
219noinst_PROGRAMS += tests/test-multipath
220tests_test_multipath_SOURCES = tests/test-multipath.c
bde9f75d 221tests_test_multipath_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
53ddd40a 222
f696f12f
JP
223noinst_PROGRAMS += tests/test-packets
224tests_test_packets_SOURCES = tests/test-packets.c
bde9f75d 225tests_test_packets_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
f696f12f 226
78f3f316
BP
227noinst_PROGRAMS += tests/test-random
228tests_test_random_SOURCES = tests/test-random.c
bde9f75d 229tests_test_random_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
78f3f316 230
829a7d02
JP
231noinst_PROGRAMS += tests/test-stp
232tests_test_stp_SOURCES = tests/test-stp.c
bde9f75d 233tests_test_stp_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
829a7d02 234
17f7f7e0
BP
235noinst_PROGRAMS += tests/test-netflow
236tests_test_netflow_SOURCES = tests/test-netflow.c
bde9f75d 237tests_test_netflow_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
17f7f7e0 238
6e170b4c
BP
239noinst_PROGRAMS += tests/test-unix-socket
240tests_test_unix_socket_SOURCES = tests/test-unix-socket.c
bde9f75d 241tests_test_unix_socket_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
6e170b4c 242
3bffc610
BP
243noinst_PROGRAMS += tests/test-odp
244tests_test_odp_SOURCES = tests/test-odp.c
bde9f75d 245tests_test_odp_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
3bffc610 246
f85f8ebb 247noinst_PROGRAMS += tests/test-ovsdb
00732bf5
BP
248tests_test_ovsdb_SOURCES = \
249 tests/test-ovsdb.c \
250 tests/idltest.c \
251 tests/idltest.h
7360012b 252EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
a26cc67c 253tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
00732bf5
BP
254
255# idltest schema and IDL
2c84fdf2 256OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
00732bf5
BP
257IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
258EXTRA_DIST += $(IDLTEST_IDL_FILES)
259tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
260 $(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp
261 mv $@.tmp $@
262
b0fc010a 263tests/idltest.c: tests/idltest.h
f85f8ebb 264
3ed497fc
BP
265noinst_PROGRAMS += tests/test-reconnect
266tests_test_reconnect_SOURCES = tests/test-reconnect.c
bde9f75d 267tests_test_reconnect_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
3ed497fc 268
d138cd2c
BP
269noinst_PROGRAMS += tests/test-sha1
270tests_test_sha1_SOURCES = tests/test-sha1.c
bde9f75d 271tests_test_sha1_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
d138cd2c 272
e7cfedd6
BP
273noinst_PROGRAMS += tests/test-timeval
274tests_test_timeval_SOURCES = tests/test-timeval.c
bde9f75d 275tests_test_timeval_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
e7cfedd6 276
78f172aa
BP
277noinst_PROGRAMS += tests/test-strtok_r
278tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
279
064af421
BP
280noinst_PROGRAMS += tests/test-type-props
281tests_test_type_props_SOURCES = tests/test-type-props.c
282
711e0157
BP
283noinst_PROGRAMS += tests/test-util
284tests_test_util_SOURCES = tests/test-util.c
bde9f75d 285tests_test_util_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
711e0157 286
d918d9d1
BP
287noinst_PROGRAMS += tests/test-uuid
288tests_test_uuid_SOURCES = tests/test-uuid.c
bde9f75d 289tests_test_uuid_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
d918d9d1 290
48d973e3
BP
291noinst_PROGRAMS += tests/test-vconn
292tests_test_vconn_SOURCES = tests/test-vconn.c
293tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
99155935 294
10a24935
BP
295noinst_PROGRAMS += tests/test-byte-order
296tests_test_byte_order_SOURCES = tests/test-byte-order.c
297tests_test_byte_order_LDADD = lib/libopenvswitch.a
965f03d8 298
37b694e7
BP
299EXTRA_DIST += tests/choose-port.pl
300
99155935 301# Python tests.
79982e90 302CHECK_PYFILES = \
0a68ffd2 303 tests/appctl.py \
99155935
BP
304 tests/test-daemon.py \
305 tests/test-json.py \
306 tests/test-jsonrpc.py \
307 tests/test-ovsdb.py \
1b0fdca5 308 tests/test-reconnect.py \
8ed182d8 309 tests/MockXenAPI.py \
0a68ffd2 310 tests/test-unixctl.py \
8ed182d8 311 tests/test-vlog.py
79982e90
EJ
312EXTRA_DIST += $(CHECK_PYFILES)
313PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
15b619e2
BP
314
315if HAVE_OPENSSL
316TESTPKI_FILES = \
317 tests/testpki-cacert.pem \
318 tests/testpki-cert.pem \
319 tests/testpki-privkey.pem \
320 tests/testpki-req.pem \
321 tests/testpki-cert2.pem \
322 tests/testpki-privkey2.pem \
323 tests/testpki-req2.pem
324check_DATA += $(TESTPKI_FILES)
325CLEANFILES += $(TESTPKI_FILES)
326
327tests/testpki-cacert.pem: tests/pki/stamp; cp tests/pki/switchca/cacert.pem $@
328tests/testpki-cert.pem: tests/pki/stamp; cp tests/pki/test-cert.pem $@
329tests/testpki-req.pem: tests/pki/stamp; cp tests/pki/test-req.pem $@
330tests/testpki-privkey.pem: tests/pki/stamp; cp tests/pki/test-privkey.pem $@
331tests/testpki-cert2.pem: tests/pki/stamp; cp tests/pki/test2-cert.pem $@
332tests/testpki-req2.pem: tests/pki/stamp; cp tests/pki/test2-req.pem $@
333tests/testpki-privkey2.pem: tests/pki/stamp; cp tests/pki/test2-privkey.pem $@
334
335OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
336tests/pki/stamp:
337 rm -f tests/pki/stamp
338 rm -rf tests/pki
339 $(OVS_PKI) init
340 $(OVS_PKI) req+sign tests/pki/test
341 $(OVS_PKI) req+sign tests/pki/test2
342 : > tests/pki/stamp
343CLEANFILES += tests/ovs-pki.log
344
345CLEAN_LOCAL += clean-pki
346clean-pki:
347 rm -f tests/pki/stamp
348 rm -rf tests/pki
349endif