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