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