]> git.proxmox.com Git - mirror_ovs.git/blob - tests/automake.mk
tests: Reduce risk of port collision and remove bash dependency.
[mirror_ovs.git] / tests / automake.mk
1 EXTRA_DIST += \
2 $(TESTSUITE_AT) \
3 $(TESTSUITE) \
4 tests/atlocal.in \
5 $(srcdir)/package.m4 \
6 $(srcdir)/tests/testsuite
7 TESTSUITE_AT = \
8 tests/testsuite.at \
9 tests/ovsdb-macros.at \
10 tests/library.at \
11 tests/heap.at \
12 tests/bundle.at \
13 tests/classifier.at \
14 tests/check-structs.at \
15 tests/daemon.at \
16 tests/daemon-py.at \
17 tests/ofp-print.at \
18 tests/ovs-ofctl.at \
19 tests/odp.at \
20 tests/multipath.at \
21 tests/autopath.at \
22 tests/lacp.at \
23 tests/learn.at \
24 tests/vconn.at \
25 tests/file_name.at \
26 tests/aes128.at \
27 tests/uuid.at \
28 tests/json.at \
29 tests/jsonrpc.at \
30 tests/jsonrpc-py.at \
31 tests/timeval.at \
32 tests/lockfile.at \
33 tests/reconnect.at \
34 tests/ofproto-dpif.at \
35 tests/ofproto-macros.at \
36 tests/ofproto.at \
37 tests/ovsdb.at \
38 tests/ovsdb-log.at \
39 tests/ovsdb-types.at \
40 tests/ovsdb-data.at \
41 tests/ovsdb-column.at \
42 tests/ovsdb-table.at \
43 tests/ovsdb-row.at \
44 tests/ovsdb-schema.at \
45 tests/ovsdb-condition.at \
46 tests/ovsdb-mutation.at \
47 tests/ovsdb-query.at \
48 tests/ovsdb-transaction.at \
49 tests/ovsdb-execution.at \
50 tests/ovsdb-trigger.at \
51 tests/ovsdb-tool.at \
52 tests/ovsdb-server.at \
53 tests/ovsdb-monitor.at \
54 tests/ovsdb-idl.at \
55 tests/ovs-vsctl.at \
56 tests/ovs-monitor-ipsec.at \
57 tests/ovs-xapi-sync.at \
58 tests/stp.at \
59 tests/interface-reconfigure.at \
60 tests/vlog.at
61 TESTSUITE = $(srcdir)/tests/testsuite
62 DISTCLEANFILES += tests/atconfig tests/atlocal
63
64 AUTOTEST_PATH = utilities:vswitchd:ovsdb:tests
65
66 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
67 $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
68 \f
69 # lcov support
70
71 lcov_wrappers = \
72 tests/lcov/ovs-appctl \
73 tests/lcov/ovs-ofctl \
74 tests/lcov/ovs-vsctl \
75 tests/lcov/ovs-vswitchd \
76 tests/lcov/ovsdb-client \
77 tests/lcov/ovsdb-server \
78 tests/lcov/ovsdb-tool \
79 tests/lcov/test-aes128 \
80 tests/lcov/test-bundle \
81 tests/lcov/test-byte-order \
82 tests/lcov/test-classifier \
83 tests/lcov/test-csum \
84 tests/lcov/test-file_name \
85 tests/lcov/test-flows \
86 tests/lcov/test-hash \
87 tests/lcov/test-heap \
88 tests/lcov/test-hmap \
89 tests/lcov/test-json \
90 tests/lcov/test-jsonrpc \
91 tests/lcov/test-list \
92 tests/lcov/test-lockfile \
93 tests/lcov/test-multipath \
94 tests/lcov/test-odp \
95 tests/lcov/test-ovsdb \
96 tests/lcov/test-packets \
97 tests/lcov/test-random \
98 tests/lcov/test-reconnect \
99 tests/lcov/test-sha1 \
100 tests/lcov/test-stp \
101 tests/lcov/test-timeval \
102 tests/lcov/test-type-props \
103 tests/lcov/test-unix-socket \
104 tests/lcov/test-uuid \
105 tests/lcov/test-vconn
106
107 $(lcov_wrappers): tests/lcov-wrapper.in
108 @test -d tests/lcov || mkdir tests/lcov
109 sed -e 's,[@]abs_top_builddir[@],$(abs_top_builddir),' \
110 -e 's,[@]wrap_program[@],$@,' \
111 $(top_srcdir)/tests/lcov-wrapper.in > $@.tmp
112 chmod +x $@.tmp
113 mv $@.tmp $@
114 CLEANFILES += $(lcov_wrappers)
115 EXTRA_DIST += tests/lcov-wrapper.in
116
117 LCOV = lcov -b $(abs_top_builddir) -d $(abs_top_builddir) -q
118 check-lcov: all tests/atconfig tests/atlocal $(TESTSUITE) $(lcov_wrappers)
119 rm -fr tests/coverage.html tests/coverage.info
120 $(LCOV) -c -i -o - > tests/coverage.info
121 $(SHELL) '$(TESTSUITE)' -C tests CHECK_LCOV=true DISABLE_LCOV=false AUTOTEST_PATH='tests/lcov:$(AUTOTEST_PATH)' $(TESTSUITEFLAGS); \
122 rc=$$?; \
123 echo "Producing coverage.html..."; \
124 cd tests && genhtml -q -o coverage.html coverage.info; \
125 exit $$rc
126 \f
127 # valgrind support
128
129 valgrind_wrappers = \
130 tests/valgrind/ovs-appctl \
131 tests/valgrind/ovs-ofctl \
132 tests/valgrind/ovs-vsctl \
133 tests/valgrind/ovs-vswitchd \
134 tests/valgrind/ovsdb-client \
135 tests/valgrind/ovsdb-server \
136 tests/valgrind/ovsdb-tool \
137 tests/valgrind/test-aes128 \
138 tests/valgrind/test-bundle \
139 tests/valgrind/test-byte-order \
140 tests/valgrind/test-classifier \
141 tests/valgrind/test-csum \
142 tests/valgrind/test-file_name \
143 tests/valgrind/test-flows \
144 tests/valgrind/test-hash \
145 tests/valgrind/test-heap \
146 tests/valgrind/test-hmap \
147 tests/valgrind/test-json \
148 tests/valgrind/test-jsonrpc \
149 tests/valgrind/test-list \
150 tests/valgrind/test-lockfile \
151 tests/valgrind/test-multipath \
152 tests/valgrind/test-odp \
153 tests/valgrind/test-ovsdb \
154 tests/valgrind/test-packets \
155 tests/valgrind/test-random \
156 tests/valgrind/test-reconnect \
157 tests/valgrind/test-sha1 \
158 tests/valgrind/test-stp \
159 tests/valgrind/test-timeval \
160 tests/valgrind/test-type-props \
161 tests/valgrind/test-unix-socket \
162 tests/valgrind/test-uuid \
163 tests/valgrind/test-vconn
164
165 $(valgrind_wrappers): tests/valgrind-wrapper.in
166 @test -d tests/valgrind || mkdir tests/valgrind
167 sed -e 's,[@]wrap_program[@],$@,' \
168 $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp
169 chmod +x $@.tmp
170 mv $@.tmp $@
171 CLEANFILES += $(valgrind_wrappers)
172 EXTRA_DIST += tests/valgrind-wrapper.in
173
174 VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
175 --suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
176 EXTRA_DIST += tests/openssl.supp
177 check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) $(valgrind_wrappers)
178 $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
179 @echo
180 @echo '----------------------------------------------------------------------'
181 @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
182 @echo '----------------------------------------------------------------------'
183 \f
184 clean-local:
185 test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
186
187 AUTOM4TE = autom4te
188 AUTOTEST = $(AUTOM4TE) --language=autotest
189 $(TESTSUITE): package.m4 $(TESTSUITE_AT)
190 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
191 mv $@.tmp $@
192
193 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
194 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
195 :;{ \
196 echo '# Signature of the current package.' && \
197 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
198 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
199 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
200 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
201 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
202 } >'$(srcdir)/package.m4'
203
204 noinst_PROGRAMS += tests/test-aes128
205 tests_test_aes128_SOURCES = tests/test-aes128.c
206 tests_test_aes128_LDADD = lib/libopenvswitch.a
207
208 noinst_PROGRAMS += tests/test-bundle
209 tests_test_bundle_SOURCES = tests/test-bundle.c
210 tests_test_bundle_LDADD = lib/libopenvswitch.a
211
212 noinst_PROGRAMS += tests/test-classifier
213 tests_test_classifier_SOURCES = tests/test-classifier.c
214 tests_test_classifier_LDADD = lib/libopenvswitch.a
215
216 noinst_PROGRAMS += tests/test-csum
217 tests_test_csum_SOURCES = tests/test-csum.c
218 tests_test_csum_LDADD = lib/libopenvswitch.a
219
220 noinst_PROGRAMS += tests/test-file_name
221 tests_test_file_name_SOURCES = tests/test-file_name.c
222 tests_test_file_name_LDADD = lib/libopenvswitch.a
223
224 noinst_PROGRAMS += tests/test-flows
225 tests_test_flows_SOURCES = tests/test-flows.c
226 tests_test_flows_LDADD = lib/libopenvswitch.a
227 dist_check_SCRIPTS = tests/flowgen.pl
228
229 noinst_PROGRAMS += tests/test-hash
230 tests_test_hash_SOURCES = tests/test-hash.c
231 tests_test_hash_LDADD = lib/libopenvswitch.a
232
233 noinst_PROGRAMS += tests/test-heap
234 tests_test_heap_SOURCES = tests/test-heap.c
235 tests_test_heap_LDADD = lib/libopenvswitch.a
236
237 noinst_PROGRAMS += tests/test-hmap
238 tests_test_hmap_SOURCES = tests/test-hmap.c
239 tests_test_hmap_LDADD = lib/libopenvswitch.a
240
241 noinst_PROGRAMS += tests/test-json
242 tests_test_json_SOURCES = tests/test-json.c
243 tests_test_json_LDADD = lib/libopenvswitch.a
244
245 noinst_PROGRAMS += tests/test-jsonrpc
246 tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
247 tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
248
249 noinst_PROGRAMS += tests/test-list
250 tests_test_list_SOURCES = tests/test-list.c
251 tests_test_list_LDADD = lib/libopenvswitch.a
252
253 noinst_PROGRAMS += tests/test-lockfile
254 tests_test_lockfile_SOURCES = tests/test-lockfile.c
255 tests_test_lockfile_LDADD = lib/libopenvswitch.a
256
257 noinst_PROGRAMS += tests/test-multipath
258 tests_test_multipath_SOURCES = tests/test-multipath.c
259 tests_test_multipath_LDADD = lib/libopenvswitch.a
260
261 noinst_PROGRAMS += tests/test-packets
262 tests_test_packets_SOURCES = tests/test-packets.c
263 tests_test_packets_LDADD = lib/libopenvswitch.a
264
265 noinst_PROGRAMS += tests/test-random
266 tests_test_random_SOURCES = tests/test-random.c
267 tests_test_random_LDADD = lib/libopenvswitch.a
268
269 noinst_PROGRAMS += tests/test-stp
270 tests_test_stp_SOURCES = tests/test-stp.c
271 tests_test_stp_LDADD = lib/libopenvswitch.a
272
273 noinst_PROGRAMS += tests/test-netflow
274 tests_test_netflow_SOURCES = tests/test-netflow.c
275 tests_test_netflow_LDADD = lib/libopenvswitch.a
276
277 noinst_PROGRAMS += tests/test-unix-socket
278 tests_test_unix_socket_SOURCES = tests/test-unix-socket.c
279 tests_test_unix_socket_LDADD = lib/libopenvswitch.a
280
281 noinst_PROGRAMS += tests/test-odp
282 tests_test_odp_SOURCES = tests/test-odp.c
283 tests_test_odp_LDADD = lib/libopenvswitch.a
284
285 noinst_PROGRAMS += tests/test-ovsdb
286 tests_test_ovsdb_SOURCES = \
287 tests/test-ovsdb.c \
288 tests/idltest.c \
289 tests/idltest.h
290 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
291 tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
292
293 # idltest schema and IDL
294 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
295 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
296 EXTRA_DIST += $(IDLTEST_IDL_FILES)
297 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
298 $(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp
299 mv $@.tmp $@
300
301 tests/idltest.c: tests/idltest.h
302
303 noinst_PROGRAMS += tests/test-reconnect
304 tests_test_reconnect_SOURCES = tests/test-reconnect.c
305 tests_test_reconnect_LDADD = lib/libopenvswitch.a
306
307 noinst_PROGRAMS += tests/test-sha1
308 tests_test_sha1_SOURCES = tests/test-sha1.c
309 tests_test_sha1_LDADD = lib/libopenvswitch.a
310
311 noinst_PROGRAMS += tests/test-timeval
312 tests_test_timeval_SOURCES = tests/test-timeval.c
313 tests_test_timeval_LDADD = lib/libopenvswitch.a
314
315 noinst_PROGRAMS += tests/test-strtok_r
316 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
317
318 noinst_PROGRAMS += tests/test-type-props
319 tests_test_type_props_SOURCES = tests/test-type-props.c
320
321 noinst_PROGRAMS += tests/test-util
322 tests_test_util_SOURCES = tests/test-util.c
323 tests_test_util_LDADD = lib/libopenvswitch.a
324
325 noinst_PROGRAMS += tests/test-uuid
326 tests_test_uuid_SOURCES = tests/test-uuid.c
327 tests_test_uuid_LDADD = lib/libopenvswitch.a
328
329 noinst_PROGRAMS += tests/test-vconn
330 tests_test_vconn_SOURCES = tests/test-vconn.c
331 tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
332
333 noinst_PROGRAMS += tests/test-byte-order
334 tests_test_byte_order_SOURCES = tests/test-byte-order.c
335 tests_test_byte_order_LDADD = lib/libopenvswitch.a
336
337 EXTRA_DIST += tests/choose-port.pl
338
339 # Python tests.
340 EXTRA_DIST += \
341 tests/test-daemon.py \
342 tests/test-json.py \
343 tests/test-jsonrpc.py \
344 tests/test-ovsdb.py \
345 tests/test-reconnect.py \
346 tests/MockXenAPI.py \
347 tests/test-vlog.py
348
349 if HAVE_OPENSSL
350 TESTPKI_FILES = \
351 tests/testpki-cacert.pem \
352 tests/testpki-cert.pem \
353 tests/testpki-privkey.pem \
354 tests/testpki-req.pem \
355 tests/testpki-cert2.pem \
356 tests/testpki-privkey2.pem \
357 tests/testpki-req2.pem
358 check_DATA += $(TESTPKI_FILES)
359 CLEANFILES += $(TESTPKI_FILES)
360
361 tests/testpki-cacert.pem: tests/pki/stamp; cp tests/pki/switchca/cacert.pem $@
362 tests/testpki-cert.pem: tests/pki/stamp; cp tests/pki/test-cert.pem $@
363 tests/testpki-req.pem: tests/pki/stamp; cp tests/pki/test-req.pem $@
364 tests/testpki-privkey.pem: tests/pki/stamp; cp tests/pki/test-privkey.pem $@
365 tests/testpki-cert2.pem: tests/pki/stamp; cp tests/pki/test2-cert.pem $@
366 tests/testpki-req2.pem: tests/pki/stamp; cp tests/pki/test2-req.pem $@
367 tests/testpki-privkey2.pem: tests/pki/stamp; cp tests/pki/test2-privkey.pem $@
368
369 OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
370 tests/pki/stamp:
371 rm -f tests/pki/stamp
372 rm -rf tests/pki
373 $(OVS_PKI) init
374 $(OVS_PKI) req+sign tests/pki/test
375 $(OVS_PKI) req+sign tests/pki/test2
376 : > tests/pki/stamp
377 CLEANFILES += tests/ovs-pki.log
378
379 CLEAN_LOCAL += clean-pki
380 clean-pki:
381 rm -f tests/pki/stamp
382 rm -rf tests/pki
383 endif