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