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