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