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