ovs-openflowd: Rename test-openflowd and move to "tests" directory.
[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/classifier.at \
12         tests/check-structs.at \
13         tests/daemon.at \
14         tests/daemon-py.at \
15         tests/ofp-print.at \
16         tests/ovs-ofctl.at \
17         tests/multipath.at \
18         tests/autopath.at \
19         tests/vconn.at \
20         tests/file_name.at \
21         tests/aes128.at \
22         tests/uuid.at \
23         tests/json.at \
24         tests/jsonrpc.at \
25         tests/jsonrpc-py.at \
26         tests/timeval.at \
27         tests/lockfile.at \
28         tests/reconnect.at \
29         tests/ofproto-macros.at \
30         tests/ofproto.at \
31         tests/ovsdb.at \
32         tests/ovsdb-log.at \
33         tests/ovsdb-types.at \
34         tests/ovsdb-data.at \
35         tests/ovsdb-column.at \
36         tests/ovsdb-table.at \
37         tests/ovsdb-row.at \
38         tests/ovsdb-schema.at \
39         tests/ovsdb-condition.at \
40         tests/ovsdb-mutation.at \
41         tests/ovsdb-query.at \
42         tests/ovsdb-transaction.at \
43         tests/ovsdb-execution.at \
44         tests/ovsdb-trigger.at \
45         tests/ovsdb-tool.at \
46         tests/ovsdb-server.at \
47         tests/ovsdb-monitor.at \
48         tests/ovsdb-idl.at \
49         tests/ovsdb-idl-py.at \
50         tests/ovs-vsctl.at \
51         tests/interface-reconfigure.at
52 TESTSUITE = $(srcdir)/tests/testsuite
53 DISTCLEANFILES += tests/atconfig tests/atlocal
54
55 AUTOTEST_PATH = utilities:vswitchd:ovsdb:tests
56
57 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
58         $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
59 \f
60 # lcov support
61
62 lcov_wrappers = \
63         tests/lcov/ovs-appctl \
64         tests/lcov/ovs-vsctl \
65         tests/lcov/ovsdb-client \
66         tests/lcov/ovsdb-server \
67         tests/lcov/ovsdb-tool \
68         tests/lcov/test-aes128 \
69         tests/lcov/test-byte-order \
70         tests/lcov/test-classifier \
71         tests/lcov/test-csum \
72         tests/lcov/test-file_name \
73         tests/lcov/test-flows \
74         tests/lcov/test-hash \
75         tests/lcov/test-hmap \
76         tests/lcov/test-json \
77         tests/lcov/test-jsonrpc \
78         tests/lcov/test-list \
79         tests/lcov/test-lockfile \
80         tests/lcov/test-multipath \
81         tests/lcov/test-ovsdb \
82         tests/lcov/test-packets \
83         tests/lcov/test-random \
84         tests/lcov/test-reconnect \
85         tests/lcov/test-sha1 \
86         tests/lcov/test-timeval \
87         tests/lcov/test-type-props \
88         tests/lcov/test-unix-socket \
89         tests/lcov/test-uuid \
90         tests/lcov/test-vconn
91
92 $(lcov_wrappers): tests/lcov-wrapper.in
93         @test -d tests/lcov || mkdir tests/lcov
94         sed -e 's,[@]abs_top_builddir[@],$(abs_top_builddir),' \
95             -e 's,[@]wrap_program[@],$@,' \
96                 $(top_srcdir)/tests/lcov-wrapper.in > $@.tmp
97         chmod +x $@.tmp
98         mv $@.tmp $@
99 CLEANFILES += $(lcov_wrappers)
100 EXTRA_DIST += tests/lcov-wrapper.in
101
102 LCOV = lcov -b $(abs_top_builddir) -d $(abs_top_builddir) -q
103 check-lcov: all tests/atconfig tests/atlocal $(TESTSUITE) $(lcov_wrappers)
104         rm -fr tests/coverage.html tests/coverage.info
105         $(LCOV) -c -i -o - > tests/coverage.info
106         $(SHELL) '$(TESTSUITE)' -C tests CHECK_LCOV=true DISABLE_LCOV=false AUTOTEST_PATH='tests/lcov:$(AUTOTEST_PATH)' $(TESTSUITEFLAGS); \
107                 rc=$$?; \
108                 echo "Producing coverage.html..."; \
109                 cd tests && genhtml -q -o coverage.html coverage.info; \
110                 exit $$rc
111 \f
112 # valgrind support
113
114 valgrind_wrappers = \
115         tests/valgrind/ovs-appctl \
116         tests/valgrind/ovs-vsctl \
117         tests/valgrind/ovsdb-client \
118         tests/valgrind/ovsdb-server \
119         tests/valgrind/ovsdb-tool \
120         tests/valgrind/test-aes128 \
121         tests/valgrind/test-byte-order \
122         tests/valgrind/test-classifier \
123         tests/valgrind/test-csum \
124         tests/valgrind/test-file_name \
125         tests/valgrind/test-flows \
126         tests/valgrind/test-hash \
127         tests/valgrind/test-hmap \
128         tests/valgrind/test-json \
129         tests/valgrind/test-jsonrpc \
130         tests/valgrind/test-list \
131         tests/valgrind/test-lockfile \
132         tests/valgrind/test-multipath \
133         tests/valgrind/test-openflowd \
134         tests/valgrind/test-ovsdb \
135         tests/valgrind/test-packets \
136         tests/valgrind/test-random \
137         tests/valgrind/test-reconnect \
138         tests/valgrind/test-sha1 \
139         tests/valgrind/test-timeval \
140         tests/valgrind/test-type-props \
141         tests/valgrind/test-unix-socket \
142         tests/valgrind/test-uuid \
143         tests/valgrind/test-vconn
144
145 $(valgrind_wrappers): tests/valgrind-wrapper.in
146         @test -d tests/valgrind || mkdir tests/valgrind
147         sed -e 's,[@]wrap_program[@],$@,' \
148                 $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp
149         chmod +x $@.tmp
150         mv $@.tmp $@
151 CLEANFILES += $(valgrind_wrappers)
152 EXTRA_DIST += tests/valgrind-wrapper.in
153
154 VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
155         --suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
156 EXTRA_DIST += tests/openssl.supp
157 check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) $(valgrind_wrappers)
158         $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
159         @echo
160         @echo '----------------------------------------------------------------------'
161         @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
162         @echo '----------------------------------------------------------------------'
163 \f
164 clean-local:
165         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
166
167 AUTOM4TE = autom4te
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-aes128
185 tests_test_aes128_SOURCES = tests/test-aes128.c
186 tests_test_aes128_LDADD = lib/libopenvswitch.a
187
188 noinst_PROGRAMS += tests/test-classifier
189 tests_test_classifier_SOURCES = tests/test-classifier.c
190 tests_test_classifier_LDADD = lib/libopenvswitch.a
191
192 noinst_PROGRAMS += tests/test-csum
193 tests_test_csum_SOURCES = tests/test-csum.c
194 tests_test_csum_LDADD = lib/libopenvswitch.a
195
196 noinst_PROGRAMS += tests/test-file_name
197 tests_test_file_name_SOURCES = tests/test-file_name.c
198 tests_test_file_name_LDADD = lib/libopenvswitch.a
199
200 noinst_PROGRAMS += tests/test-flows
201 tests_test_flows_SOURCES = tests/test-flows.c
202 tests_test_flows_LDADD = lib/libopenvswitch.a
203 dist_check_SCRIPTS = tests/flowgen.pl
204
205 noinst_PROGRAMS += tests/test-hash
206 tests_test_hash_SOURCES = tests/test-hash.c
207 tests_test_hash_LDADD = lib/libopenvswitch.a
208
209 noinst_PROGRAMS += tests/test-hmap
210 tests_test_hmap_SOURCES = tests/test-hmap.c
211 tests_test_hmap_LDADD = lib/libopenvswitch.a
212
213 noinst_PROGRAMS += tests/test-json
214 tests_test_json_SOURCES = tests/test-json.c
215 tests_test_json_LDADD = lib/libopenvswitch.a
216
217 noinst_PROGRAMS += tests/test-jsonrpc
218 tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
219 tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
220
221 noinst_PROGRAMS += tests/test-list
222 tests_test_list_SOURCES = tests/test-list.c
223 tests_test_list_LDADD = lib/libopenvswitch.a
224
225 noinst_PROGRAMS += tests/test-lockfile
226 tests_test_lockfile_SOURCES = tests/test-lockfile.c
227 tests_test_lockfile_LDADD = lib/libopenvswitch.a
228
229 noinst_PROGRAMS += tests/test-multipath
230 tests_test_multipath_SOURCES = tests/test-multipath.c
231 tests_test_multipath_LDADD = lib/libopenvswitch.a
232
233 noinst_PROGRAMS += tests/test-openflowd
234 EXTRA_DIST += tests/test-openflowd.8.in
235 DISTCLEANFILES += tests/test-openflowd.8
236 noinst_man_MANS += tests/ovs-openflowd.8
237 tests_test_openflowd_SOURCES = tests/test-openflowd.c
238 tests_test_openflowd_LDADD = \
239         ofproto/libofproto.a \
240         lib/libsflow.a \
241         lib/libopenvswitch.a \
242         $(SSL_LIBS)
243
244
245 noinst_PROGRAMS += tests/test-packets
246 tests_test_packets_SOURCES = tests/test-packets.c
247 tests_test_packets_LDADD = lib/libopenvswitch.a
248
249 noinst_PROGRAMS += tests/test-random
250 tests_test_random_SOURCES = tests/test-random.c
251 tests_test_random_LDADD = lib/libopenvswitch.a
252
253 noinst_PROGRAMS += tests/test-unix-socket
254 tests_test_unix_socket_SOURCES = tests/test-unix-socket.c
255 tests_test_unix_socket_LDADD = lib/libopenvswitch.a
256
257 noinst_PROGRAMS += tests/test-ovsdb
258 tests_test_ovsdb_SOURCES = \
259         tests/test-ovsdb.c \
260         tests/idltest.c \
261         tests/idltest.h
262 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
263 tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
264
265 # idltest schema and IDL
266 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
267 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
268 EXTRA_DIST += $(IDLTEST_IDL_FILES)
269 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
270         $(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp
271         mv $@.tmp $@
272
273 tests/idltest.c: tests/idltest.h
274
275 noinst_PROGRAMS += tests/test-reconnect
276 tests_test_reconnect_SOURCES = tests/test-reconnect.c
277 tests_test_reconnect_LDADD = lib/libopenvswitch.a
278
279 noinst_PROGRAMS += tests/test-sha1
280 tests_test_sha1_SOURCES = tests/test-sha1.c
281 tests_test_sha1_LDADD = lib/libopenvswitch.a
282
283 noinst_PROGRAMS += tests/test-timeval
284 tests_test_timeval_SOURCES = tests/test-timeval.c
285 tests_test_timeval_LDADD = lib/libopenvswitch.a
286
287 noinst_PROGRAMS += tests/test-strtok_r
288 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
289
290 noinst_PROGRAMS += tests/test-type-props
291 tests_test_type_props_SOURCES = tests/test-type-props.c
292
293 noinst_PROGRAMS += tests/test-uuid
294 tests_test_uuid_SOURCES = tests/test-uuid.c
295 tests_test_uuid_LDADD = lib/libopenvswitch.a
296
297 noinst_PROGRAMS += tests/test-vconn
298 tests_test_vconn_SOURCES = tests/test-vconn.c
299 tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
300
301 noinst_PROGRAMS += tests/test-byte-order
302 tests_test_byte_order_SOURCES = tests/test-byte-order.c
303 tests_test_byte_order_LDADD = lib/libopenvswitch.a
304
305 # Python tests.
306 EXTRA_DIST += \
307         tests/test-daemon.py \
308         tests/test-json.py \
309         tests/test-jsonrpc.py \
310         tests/test-ovsdb.py \
311         tests/test-reconnect.py
312
313 if HAVE_OPENSSL
314 TESTPKI_FILES = \
315         tests/testpki-cacert.pem \
316         tests/testpki-cert.pem \
317         tests/testpki-privkey.pem \
318         tests/testpki-req.pem \
319         tests/testpki-cert2.pem \
320         tests/testpki-privkey2.pem \
321         tests/testpki-req2.pem
322 check_DATA += $(TESTPKI_FILES)
323 CLEANFILES += $(TESTPKI_FILES)
324
325 tests/testpki-cacert.pem: tests/pki/stamp; cp tests/pki/switchca/cacert.pem $@
326 tests/testpki-cert.pem: tests/pki/stamp; cp tests/pki/test-cert.pem $@
327 tests/testpki-req.pem: tests/pki/stamp; cp tests/pki/test-req.pem $@
328 tests/testpki-privkey.pem: tests/pki/stamp; cp tests/pki/test-privkey.pem $@
329 tests/testpki-cert2.pem: tests/pki/stamp; cp tests/pki/test2-cert.pem $@
330 tests/testpki-req2.pem: tests/pki/stamp; cp tests/pki/test2-req.pem $@
331 tests/testpki-privkey2.pem: tests/pki/stamp; cp tests/pki/test2-privkey.pem $@
332
333 OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
334 tests/pki/stamp:
335         rm -f tests/pki/stamp
336         rm -rf tests/pki
337         $(OVS_PKI) init
338         $(OVS_PKI) req+sign tests/pki/test
339         $(OVS_PKI) req+sign tests/pki/test2
340         : > tests/pki/stamp
341 CLEANFILES += tests/ovs-pki.log
342
343 CLEAN_LOCAL += clean-pki
344 clean-pki:
345         rm -f tests/pki/stamp
346         rm -rf tests/pki
347 endif