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