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