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