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