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