tests: Don't remove testsuite on distclean.
[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/classifier.at \
12         tests/check-structs.at \
13         tests/daemon.at \
14         tests/daemon-py.at \
15         tests/ovs-ofctl.at \
16         tests/vconn.at \
17         tests/file_name.at \
18         tests/aes128.at \
19         tests/uuid.at \
20         tests/json.at \
21         tests/jsonrpc.at \
22         tests/jsonrpc-py.at \
23         tests/timeval.at \
24         tests/lockfile.at \
25         tests/reconnect.at \
26         tests/ovsdb.at \
27         tests/ovsdb-log.at \
28         tests/ovsdb-types.at \
29         tests/ovsdb-data.at \
30         tests/ovsdb-column.at \
31         tests/ovsdb-table.at \
32         tests/ovsdb-row.at \
33         tests/ovsdb-schema.at \
34         tests/ovsdb-condition.at \
35         tests/ovsdb-mutation.at \
36         tests/ovsdb-query.at \
37         tests/ovsdb-transaction.at \
38         tests/ovsdb-execution.at \
39         tests/ovsdb-trigger.at \
40         tests/ovsdb-tool.at \
41         tests/ovsdb-server.at \
42         tests/ovsdb-monitor.at \
43         tests/ovsdb-idl.at \
44         tests/ovsdb-idl-py.at \
45         tests/ovs-vsctl.at \
46         tests/interface-reconfigure.at
47 TESTSUITE = $(srcdir)/tests/testsuite
48 DISTCLEANFILES += tests/atconfig tests/atlocal
49
50 AUTOTEST_PATH = utilities:vswitchd:ovsdb:tests
51
52 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
53         $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
54 \f
55 # lcov support
56
57 lcov_wrappers = \
58         tests/lcov/ovs-appctl \
59         tests/lcov/ovs-vsctl \
60         tests/lcov/ovsdb-client \
61         tests/lcov/ovsdb-server \
62         tests/lcov/ovsdb-tool \
63         tests/lcov/test-aes128 \
64         tests/lcov/test-byte-order \
65         tests/lcov/test-classifier \
66         tests/lcov/test-csum \
67         tests/lcov/test-dhcp-client \
68         tests/lcov/test-file_name \
69         tests/lcov/test-flows \
70         tests/lcov/test-hash \
71         tests/lcov/test-hmap \
72         tests/lcov/test-json \
73         tests/lcov/test-jsonrpc \
74         tests/lcov/test-list \
75         tests/lcov/test-lockfile \
76         tests/lcov/test-ovsdb \
77         tests/lcov/test-random \
78         tests/lcov/test-reconnect \
79         tests/lcov/test-sha1 \
80         tests/lcov/test-timeval \
81         tests/lcov/test-type-props \
82         tests/lcov/test-unix-socket \
83         tests/lcov/test-uuid \
84         tests/lcov/test-vconn
85
86 $(lcov_wrappers): tests/lcov-wrapper.in
87         @test -d tests/lcov || mkdir tests/lcov
88         sed -e 's,[@]abs_top_builddir[@],$(abs_top_builddir),' \
89             -e 's,[@]wrap_program[@],$@,' \
90                 $(top_srcdir)/tests/lcov-wrapper.in > $@.tmp
91         chmod +x $@.tmp
92         mv $@.tmp $@
93 CLEANFILES += $(lcov_wrappers)
94 EXTRA_DIST += tests/lcov-wrapper.in
95
96 LCOV = lcov -b $(abs_top_builddir) -d $(abs_top_builddir) -q
97 check-lcov: all tests/atconfig tests/atlocal $(TESTSUITE) $(lcov_wrappers)
98         rm -fr tests/coverage.html tests/coverage.info
99         $(LCOV) -c -i -o - > tests/coverage.info
100         $(SHELL) '$(TESTSUITE)' -C tests CHECK_LCOV=true DISABLE_LCOV=false AUTOTEST_PATH='tests/lcov:$(AUTOTEST_PATH)' $(TESTSUITEFLAGS); \
101                 rc=$$?; \
102                 echo "Producing coverage.html..."; \
103                 cd tests && genhtml -q -o coverage.html coverage.info; \
104                 exit $$rc
105 \f
106 # valgrind support
107
108 valgrind_wrappers = \
109         tests/valgrind/ovs-appctl \
110         tests/valgrind/ovs-vsctl \
111         tests/valgrind/ovsdb-client \
112         tests/valgrind/ovsdb-server \
113         tests/valgrind/ovsdb-tool \
114         tests/valgrind/test-aes128 \
115         tests/valgrind/test-byte-order \
116         tests/valgrind/test-classifier \
117         tests/valgrind/test-csum \
118         tests/valgrind/test-dhcp-client \
119         tests/valgrind/test-file_name \
120         tests/valgrind/test-flows \
121         tests/valgrind/test-hash \
122         tests/valgrind/test-hmap \
123         tests/valgrind/test-json \
124         tests/valgrind/test-jsonrpc \
125         tests/valgrind/test-list \
126         tests/valgrind/test-lockfile \
127         tests/valgrind/test-ovsdb \
128         tests/valgrind/test-random \
129         tests/valgrind/test-reconnect \
130         tests/valgrind/test-sha1 \
131         tests/valgrind/test-timeval \
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         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/openssl.supp --num-callers=20
148 EXTRA_DIST += tests/openssl.supp
149 check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) $(valgrind_wrappers)
150         $(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
151         @echo
152         @echo '----------------------------------------------------------------------'
153         @echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
154         @echo '----------------------------------------------------------------------'
155 \f
156 clean-local:
157         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
158
159 AUTOM4TE = autom4te
160 AUTOTEST = $(AUTOM4TE) --language=autotest
161 $(TESTSUITE): package.m4 $(TESTSUITE_AT)
162         $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
163         mv $@.tmp $@
164
165 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
166 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
167         :;{ \
168           echo '# Signature of the current package.' && \
169           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
170           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
171           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
172           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
173           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
174         } >'$(srcdir)/package.m4'
175
176 noinst_PROGRAMS += tests/test-aes128
177 tests_test_aes128_SOURCES = tests/test-aes128.c
178 tests_test_aes128_LDADD = lib/libopenvswitch.a
179
180 noinst_PROGRAMS += tests/test-classifier
181 tests_test_classifier_SOURCES = tests/test-classifier.c
182 tests_test_classifier_LDADD = lib/libopenvswitch.a
183
184 noinst_PROGRAMS += tests/test-csum
185 tests_test_csum_SOURCES = tests/test-csum.c
186 tests_test_csum_LDADD = lib/libopenvswitch.a
187
188 noinst_PROGRAMS += tests/test-file_name
189 tests_test_file_name_SOURCES = tests/test-file_name.c
190 tests_test_file_name_LDADD = lib/libopenvswitch.a
191
192 noinst_PROGRAMS += tests/test-flows
193 tests_test_flows_SOURCES = tests/test-flows.c
194 tests_test_flows_LDADD = lib/libopenvswitch.a
195 dist_check_SCRIPTS = tests/flowgen.pl
196
197 noinst_PROGRAMS += tests/test-hash
198 tests_test_hash_SOURCES = tests/test-hash.c
199 tests_test_hash_LDADD = lib/libopenvswitch.a
200
201 noinst_PROGRAMS += tests/test-hmap
202 tests_test_hmap_SOURCES = tests/test-hmap.c
203 tests_test_hmap_LDADD = lib/libopenvswitch.a
204
205 noinst_PROGRAMS += tests/test-json
206 tests_test_json_SOURCES = tests/test-json.c
207 tests_test_json_LDADD = lib/libopenvswitch.a
208
209 noinst_PROGRAMS += tests/test-jsonrpc
210 tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
211 tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
212
213 noinst_PROGRAMS += tests/test-list
214 tests_test_list_SOURCES = tests/test-list.c
215 tests_test_list_LDADD = lib/libopenvswitch.a
216
217 noinst_PROGRAMS += tests/test-lockfile
218 tests_test_lockfile_SOURCES = tests/test-lockfile.c
219 tests_test_lockfile_LDADD = lib/libopenvswitch.a
220
221 noinst_PROGRAMS += tests/test-random
222 tests_test_random_SOURCES = tests/test-random.c
223 tests_test_random_LDADD = lib/libopenvswitch.a
224
225 noinst_PROGRAMS += tests/test-unix-socket
226 tests_test_unix_socket_SOURCES = tests/test-unix-socket.c
227 tests_test_unix_socket_LDADD = lib/libopenvswitch.a
228
229 noinst_PROGRAMS += tests/test-ovsdb
230 tests_test_ovsdb_SOURCES = \
231         tests/test-ovsdb.c \
232         tests/idltest.c \
233         tests/idltest.h
234 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
235 tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
236
237 # idltest schema and IDL
238 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
239 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
240 EXTRA_DIST += $(IDLTEST_IDL_FILES)
241 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
242         $(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp
243         mv $@.tmp $@
244
245 tests/idltest.c: tests/idltest.h
246
247 noinst_PROGRAMS += tests/test-reconnect
248 tests_test_reconnect_SOURCES = tests/test-reconnect.c
249 tests_test_reconnect_LDADD = lib/libopenvswitch.a
250
251 noinst_PROGRAMS += tests/test-sha1
252 tests_test_sha1_SOURCES = tests/test-sha1.c
253 tests_test_sha1_LDADD = lib/libopenvswitch.a
254
255 noinst_PROGRAMS += tests/test-timeval
256 tests_test_timeval_SOURCES = tests/test-timeval.c
257 tests_test_timeval_LDADD = lib/libopenvswitch.a
258
259 noinst_PROGRAMS += tests/test-strtok_r
260 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
261
262 noinst_PROGRAMS += tests/test-type-props
263 tests_test_type_props_SOURCES = tests/test-type-props.c
264
265 noinst_PROGRAMS += tests/test-dhcp-client
266 tests_test_dhcp_client_SOURCES = tests/test-dhcp-client.c
267 tests_test_dhcp_client_LDADD = lib/libopenvswitch.a
268
269 noinst_PROGRAMS += tests/test-uuid
270 tests_test_uuid_SOURCES = tests/test-uuid.c
271 tests_test_uuid_LDADD = lib/libopenvswitch.a
272
273 noinst_PROGRAMS += tests/test-vconn
274 tests_test_vconn_SOURCES = tests/test-vconn.c
275 tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
276 EXTRA_DIST += \
277         tests/testpki-cacert.pem \
278         tests/testpki-cert.pem \
279         tests/testpki-cert2.pem \
280         tests/testpki-privkey.pem \
281         tests/testpki-privkey2.pem \
282         tests/testpki-req.pem \
283         tests/testpki-req2.pem
284
285 noinst_PROGRAMS += tests/test-byte-order
286 tests_test_byte_order_SOURCES = tests/test-byte-order.c
287 tests_test_byte_order_LDADD = lib/libopenvswitch.a
288
289 # Python tests.
290 EXTRA_DIST += \
291         tests/test-daemon.py \
292         tests/test-json.py \
293         tests/test-jsonrpc.py \
294         tests/test-ovsdb.py \
295         tests/test-reconnect.py