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