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