Rework and simplify the "lcov" support for the testsuite.
[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/check-structs.at \
12         tests/daemon.at \
13         tests/vconn.at \
14         tests/dir_name.at \
15         tests/aes128.at \
16         tests/uuid.at \
17         tests/json.at \
18         tests/jsonrpc.at \
19         tests/timeval.at \
20         tests/lockfile.at \
21         tests/reconnect.at \
22         tests/ovsdb.at \
23         tests/ovsdb-log.at \
24         tests/ovsdb-types.at \
25         tests/ovsdb-data.at \
26         tests/ovsdb-column.at \
27         tests/ovsdb-table.at \
28         tests/ovsdb-row.at \
29         tests/ovsdb-condition.at \
30         tests/ovsdb-mutation.at \
31         tests/ovsdb-query.at \
32         tests/ovsdb-transaction.at \
33         tests/ovsdb-execution.at \
34         tests/ovsdb-trigger.at \
35         tests/ovsdb-file.at \
36         tests/ovsdb-server.at \
37         tests/ovsdb-monitor.at \
38         tests/ovsdb-idl.at \
39         tests/stp.at \
40         tests/ovs-vsctl.at
41 TESTSUITE = $(srcdir)/tests/testsuite
42 DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
43
44 AUTOTEST_PATH = utilities:vswitchd:ovsdb:tests
45
46 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
47         $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
48 \f
49 # lcov support
50
51 lcov_wrappers = \
52         tests/lcov/ovs-appctl \
53         tests/lcov/ovs-vsctl \
54         tests/lcov/ovsdb-client \
55         tests/lcov/ovsdb-server \
56         tests/lcov/ovsdb-tool \
57         tests/lcov/test-aes128 \
58         tests/lcov/test-classifier \
59         tests/lcov/test-csum \
60         tests/lcov/test-dhcp-client \
61         tests/lcov/test-dir_name \
62         tests/lcov/test-flows \
63         tests/lcov/test-hash \
64         tests/lcov/test-hmap \
65         tests/lcov/test-json \
66         tests/lcov/test-jsonrpc \
67         tests/lcov/test-list \
68         tests/lcov/test-lockfile \
69         tests/lcov/test-ovsdb \
70         tests/lcov/test-reconnect \
71         tests/lcov/test-sha1 \
72         tests/lcov/test-stp \
73         tests/lcov/test-timeval \
74         tests/lcov/test-type-props \
75         tests/lcov/test-uuid \
76         tests/lcov/test-vconn
77
78 $(lcov_wrappers): tests/lcov-wrapper.in
79         @test -d tests/lcov || mkdir tests/lcov
80         sed -e 's,[@]abs_top_builddir[@],$(abs_top_builddir),' \
81             -e 's,[@]wrap_program[@],$@,' \
82                 $(top_srcdir)/tests/lcov-wrapper.in > $@.tmp
83         chmod +x $@.tmp
84         mv $@.tmp $@
85 CLEANFILES += $(lcov_wrappers)
86 EXTRA_DIST += tests/lcov-wrapper.in
87
88 LCOV = lcov -b $(abs_top_builddir) -d $(abs_top_builddir) -q
89 check-lcov: all tests/atconfig tests/atlocal $(TESTSUITE) $(lcov_wrappers)
90         rm -fr tests/coverage.html tests/coverage.info
91         $(LCOV) -c -i -o - > tests/coverage.info
92         $(SHELL) '$(TESTSUITE)' -C tests CHECK_LCOV=true AUTOTEST_PATH='tests/lcov:$(AUTOTEST_PATH)' $(TESTSUITEFLAGS); \
93                 rc=$$?; \
94                 echo "Producing coverage.html..."; \
95                 cd tests && genhtml -q -o coverage.html coverage.info; \
96                 exit $$rc
97 \f
98 clean-local:
99         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
100
101 AUTOM4TE = autom4te
102 AUTOTEST = $(AUTOM4TE) --language=autotest
103 $(TESTSUITE): package.m4 $(TESTSUITE_AT)
104         $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
105         mv $@.tmp $@
106
107 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
108 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
109         :;{ \
110           echo '# Signature of the current package.' && \
111           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
112           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
113           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
114           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
115           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
116         } >'$(srcdir)/package.m4'
117
118 noinst_PROGRAMS += tests/test-aes128
119 tests_test_aes128_SOURCES = tests/test-aes128.c
120 tests_test_aes128_LDADD = lib/libopenvswitch.a
121
122 noinst_PROGRAMS += tests/test-classifier
123 tests_test_classifier_SOURCES = tests/test-classifier.c
124 tests_test_classifier_LDADD = lib/libopenvswitch.a
125
126 noinst_PROGRAMS += tests/test-csum
127 tests_test_csum_SOURCES = tests/test-csum.c
128 tests_test_csum_LDADD = lib/libopenvswitch.a
129
130 noinst_PROGRAMS += tests/test-dir_name
131 tests_test_dir_name_SOURCES = tests/test-dir_name.c
132 tests_test_dir_name_LDADD = lib/libopenvswitch.a
133
134 noinst_PROGRAMS += tests/test-flows
135 tests_test_flows_SOURCES = tests/test-flows.c
136 tests_test_flows_LDADD = lib/libopenvswitch.a
137 dist_check_SCRIPTS = tests/flowgen.pl
138
139 noinst_PROGRAMS += tests/test-hash
140 tests_test_hash_SOURCES = tests/test-hash.c
141 tests_test_hash_LDADD = lib/libopenvswitch.a
142
143 noinst_PROGRAMS += tests/test-hmap
144 tests_test_hmap_SOURCES = tests/test-hmap.c
145 tests_test_hmap_LDADD = lib/libopenvswitch.a
146
147 noinst_PROGRAMS += tests/test-json
148 tests_test_json_SOURCES = tests/test-json.c
149 tests_test_json_LDADD = lib/libopenvswitch.a
150
151 noinst_PROGRAMS += tests/test-jsonrpc
152 tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
153 tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
154
155 noinst_PROGRAMS += tests/test-list
156 tests_test_list_SOURCES = tests/test-list.c
157 tests_test_list_LDADD = lib/libopenvswitch.a
158
159 noinst_PROGRAMS += tests/test-lockfile
160 tests_test_lockfile_SOURCES = tests/test-lockfile.c
161 tests_test_lockfile_LDADD = lib/libopenvswitch.a
162
163 noinst_PROGRAMS += tests/test-ovsdb
164 tests_test_ovsdb_SOURCES = \
165         tests/test-ovsdb.c \
166         tests/idltest.c \
167         tests/idltest.h
168 EXTRA_DIST += tests/uuidfilt.pl
169 tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
170
171 # idltest schema and IDL
172 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
173 IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
174 EXTRA_DIST += $(IDLTEST_IDL_FILES)
175 tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
176         $(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp
177         mv $@.tmp $@
178
179 tests/idltest.c: tests/idltest.h
180
181 noinst_PROGRAMS += tests/test-reconnect
182 tests_test_reconnect_SOURCES = tests/test-reconnect.c
183 tests_test_reconnect_LDADD = lib/libopenvswitch.a
184
185 noinst_PROGRAMS += tests/test-sha1
186 tests_test_sha1_SOURCES = tests/test-sha1.c
187 tests_test_sha1_LDADD = lib/libopenvswitch.a
188
189 noinst_PROGRAMS += tests/test-timeval
190 tests_test_timeval_SOURCES = tests/test-timeval.c
191 tests_test_timeval_LDADD = lib/libopenvswitch.a
192
193 noinst_PROGRAMS += tests/test-type-props
194 tests_test_type_props_SOURCES = tests/test-type-props.c
195
196 noinst_PROGRAMS += tests/test-dhcp-client
197 tests_test_dhcp_client_SOURCES = tests/test-dhcp-client.c
198 tests_test_dhcp_client_LDADD = lib/libopenvswitch.a
199
200 noinst_PROGRAMS += tests/test-stp
201 tests_test_stp_SOURCES = tests/test-stp.c
202 tests_test_stp_LDADD = lib/libopenvswitch.a
203
204 noinst_PROGRAMS += tests/test-uuid
205 tests_test_uuid_SOURCES = tests/test-uuid.c
206 tests_test_uuid_LDADD = lib/libopenvswitch.a
207
208 noinst_PROGRAMS += tests/test-vconn
209 tests_test_vconn_SOURCES = tests/test-vconn.c
210 tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
211 EXTRA_DIST += \
212         tests/testpki-cacert.pem \
213         tests/testpki-cert.pem \
214         tests/testpki-cert2.pem \
215         tests/testpki-privkey.pem \
216         tests/testpki-privkey2.pem \
217         tests/testpki-req.pem \
218         tests/testpki-req2.pem