format-guesser: Convert test to Autotest framework.
[pspp-builds.git] / tests / automake.mk
1 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
2
3 TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' top_builddir='$(top_builddir)'
4 TESTS_ENVIRONMENT += PERL='$(PERL)'
5
6 # Allow locale_charset to find charset.alias before running "make install".
7 TESTS_ENVIRONMENT += CHARSETALIASDIR='$(abs_top_builddir)/gl'
8
9 TESTS_ENVIRONMENT += LC_ALL=C
10 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
11
12 dist_TESTS = \
13         tests/formats/date-in.sh \
14         tests/formats/ib-in.sh \
15         tests/formats/legacy-in.sh \
16         tests/formats/month-in.sh \
17         tests/formats/month-out.sh \
18         tests/formats/num-in.sh \
19         tests/formats/num-out.sh \
20         tests/formats/time-in.sh \
21         tests/formats/time-out.sh \
22         tests/formats/wkday-in.sh \
23         tests/formats/wkday-out.sh \
24         tests/formats/360.sh
25
26 TESTS = $(dist_TESTS) $(nodist_TESTS)
27
28 check_PROGRAMS += \
29         $(nodist_TESTS) \
30         tests/data/datasheet-test \
31         tests/formats/inexactify \
32         tests/libpspp/abt-test \
33         tests/libpspp/bt-test \
34         tests/libpspp/heap-test \
35         tests/libpspp/hmap-test \
36         tests/libpspp/hmapx-test \
37         tests/libpspp/i18n-test \
38         tests/libpspp/ll-test \
39         tests/libpspp/llx-test \
40         tests/libpspp/range-map-test \
41         tests/libpspp/range-set-test \
42         tests/libpspp/sparse-array-test \
43         tests/libpspp/sparse-xarray-test \
44         tests/libpspp/str-test \
45         tests/libpspp/string-map-test \
46         tests/libpspp/stringi-map-test \
47         tests/libpspp/string-set-test \
48         tests/libpspp/stringi-set-test \
49         tests/libpspp/tower-test \
50         tests/output/render-test
51
52 tests_data_datasheet_test_SOURCES = \
53         tests/data/datasheet-test.c
54 tests_data_datasheet_test_LDADD = src/libpspp-core.la $(LIBINTL) 
55 tests_data_datasheet_test_CFLAGS = $(AM_CFLAGS)
56
57 tests_libpspp_ll_test_SOURCES = \
58         src/libpspp/ll.c \
59         tests/libpspp/ll-test.c
60 tests_libpspp_ll_test_LDADD = gl/libgl.la $(LIBINTL)
61 tests_libpspp_ll_test_CFLAGS = $(AM_CFLAGS)
62
63 tests_libpspp_llx_test_SOURCES = \
64         src/libpspp/ll.c \
65         src/libpspp/llx.c \
66         tests/libpspp/llx-test.c
67 tests_libpspp_llx_test_LDADD = gl/libgl.la $(LIBINTL)
68 tests_libpspp_llx_test_CFLAGS = $(AM_CFLAGS)
69
70 tests_libpspp_heap_test_SOURCES = \
71         src/libpspp/heap.c \
72         src/libpspp/pool.c \
73         src/libpspp/temp-file.c \
74         tests/libpspp/heap-test.c
75 tests_libpspp_heap_test_LDADD = gl/libgl.la $(LIBINTL) 
76 tests_libpspp_heap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
77
78 tests_libpspp_hmap_test_SOURCES = \
79         src/libpspp/hmap.c \
80         tests/libpspp/hmap-test.c
81 tests_libpspp_hmap_test_LDADD = gl/libgl.la $(LIBINTL)
82 tests_libpspp_hmap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
83
84 tests_libpspp_hmapx_test_SOURCES = \
85         src/libpspp/hmap.c \
86         src/libpspp/hmapx.c \
87         tests/libpspp/hmapx-test.c
88 tests_libpspp_hmapx_test_LDADD = gl/libgl.la $(LIBINTL)
89 tests_libpspp_hmapx_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
90
91 tests_libpspp_i18n_test_SOURCES = tests/libpspp/i18n-test.c
92 tests_libpspp_i18n_test_LDADD = src/libpspp/libpspp.la gl/libgl.la $(LIBINTL) 
93
94 tests_libpspp_abt_test_SOURCES = \
95         src/libpspp/abt.c \
96         tests/libpspp/abt-test.c
97 tests_libpspp_abt_test_LDADD = gl/libgl.la $(LIBINTL)
98 tests_libpspp_abt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
99
100 tests_libpspp_bt_test_SOURCES = \
101         src/libpspp/bt.c \
102         tests/libpspp/bt-test.c
103 tests_libpspp_bt_test_LDADD = gl/libgl.la
104 tests_libpspp_bt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
105
106 tests_libpspp_range_map_test_SOURCES = \
107         src/libpspp/bt.c \
108         src/libpspp/range-map.c \
109         tests/libpspp/range-map-test.c
110 tests_libpspp_range_map_test_LDADD = gl/libgl.la $(LIBINTL)
111 tests_libpspp_range_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
112
113 tests_libpspp_range_set_test_SOURCES = \
114         src/libpspp/bt.c \
115         src/libpspp/pool.c \
116         src/libpspp/range-set.c \
117         src/libpspp/temp-file.c \
118         tests/libpspp/range-set-test.c
119 tests_libpspp_range_set_test_LDADD = gl/libgl.la $(LIBINTL) 
120 tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
121
122 tests_libpspp_str_test_SOURCES = \
123         tests/libpspp/str-test.c
124 tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la $(LIBINTL) 
125
126 tests_libpspp_string_map_test_SOURCES = \
127         src/libpspp/hash-functions.c \
128         src/libpspp/hmap.c \
129         src/libpspp/string-map.c \
130         src/libpspp/string-set.c \
131         tests/libpspp/string-map-test.c
132 tests_libpspp_string_map_test_LDADD = gl/libgl.la $(LIBINTL)
133 tests_libpspp_string_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
134
135 tests_libpspp_stringi_map_test_SOURCES = \
136         src/libpspp/hash-functions.c \
137         src/libpspp/hmap.c \
138         src/libpspp/pool.c \
139         src/libpspp/str.c \
140         src/libpspp/stringi-map.c \
141         src/libpspp/string-set.c \
142         src/libpspp/stringi-set.c \
143         src/libpspp/temp-file.c \
144         tests/libpspp/stringi-map-test.c
145 tests_libpspp_stringi_map_test_LDADD = gl/libgl.la $(LIBINTL)
146 tests_libpspp_stringi_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
147
148 tests_libpspp_string_set_test_SOURCES = \
149         src/libpspp/hash-functions.c \
150         src/libpspp/hmap.c \
151         src/libpspp/string-set.c \
152         tests/libpspp/string-set-test.c
153 tests_libpspp_string_set_test_LDADD = gl/libgl.la $(LIBINTL)
154 tests_libpspp_string_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
155
156 tests_libpspp_stringi_set_test_SOURCES = \
157         src/libpspp/hash-functions.c \
158         src/libpspp/hmap.c \
159         src/libpspp/pool.c \
160         src/libpspp/str.c \
161         src/libpspp/stringi-set.c \
162         src/libpspp/temp-file.c \
163         tests/libpspp/stringi-set-test.c
164 tests_libpspp_stringi_set_test_LDADD = gl/libgl.la $(LIBINTL)
165 tests_libpspp_stringi_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
166
167 tests_libpspp_tower_test_SOURCES = \
168         src/libpspp/abt.c \
169         src/libpspp/pool.c \
170         src/libpspp/temp-file.c \
171         src/libpspp/tower.c \
172         tests/libpspp/tower-test.c
173 tests_libpspp_tower_test_LDADD = gl/libgl.la $(LIBINTL) 
174 tests_libpspp_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
175
176 tests_libpspp_sparse_array_test_SOURCES = \
177         src/libpspp/sparse-array.c \
178         src/libpspp/pool.c \
179         tests/libpspp/sparse-array-test.c \
180         src/libpspp/temp-file.c
181 tests_libpspp_sparse_array_test_LDADD = gl/libgl.la $(LIBINTL) 
182 tests_libpspp_sparse_array_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
183
184 tests_libpspp_sparse_xarray_test_SOURCES = \
185         src/libpspp/argv-parser.c \
186         src/libpspp/bt.c \
187         src/libpspp/deque.c \
188         src/libpspp/ext-array.c \
189         src/libpspp/model-checker.c \
190         src/libpspp/range-set.c \
191         src/libpspp/sparse-array.c \
192         src/libpspp/sparse-xarray.c \
193         src/libpspp/str.c \
194         src/libpspp/pool.c \
195         src/libpspp/temp-file.c \
196         tests/libpspp/sparse-xarray-test.c
197 tests_libpspp_sparse_xarray_test_LDADD = gl/libgl.la $(LIBINTL) 
198 tests_libpspp_sparse_xarray_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
199
200 tests_formats_inexactify_SOURCES = tests/formats/inexactify.c
201
202 noinst_PROGRAMS += tests/dissect-sysfile
203 tests_dissect_sysfile_SOURCES = \
204         src/libpspp/integer-format.c \
205         src/libpspp/float-format.c \
206         tests/dissect-sysfile.c
207 tests_dissect_sysfile_LDADD = gl/libgl.la $(LIBINTL) 
208 tests_dissect_sysfile_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
209
210 check_PROGRAMS += tests/output/render-test
211 tests_output_render_test_SOURCES = tests/output/render-test.c
212 tests_output_render_test_LDADD = \
213         src/libpspp.la \
214         src/libpspp-core.la \
215         $(CAIRO_LIBS) \
216         $(LIBICONV) \
217         $(LIBINTL)
218
219 EXTRA_DIST += \
220         $(dist_TESTS) \
221         tests/coverage.sh tests/test_template \
222         tests/data/bcd-in.expected.cmp.gz \
223         tests/data/v13.sav \
224         tests/data/v14.sav \
225         tests/formats/binhex-out.expected.gz \
226         tests/formats/ib-in.expected.cmp.gz \
227         tests/formats/legacy-in.expected.cmp.gz \
228         tests/formats/num-in.expected.gz \
229         tests/formats/num-out.expected.cmp.gz \
230         tests/formats/num-out-cmp.pl \
231         tests/formats/num-out-compare.pl \
232         tests/formats/num-out-decmp.pl \
233         tests/formats/num-out.pl \
234         tests/language/data-io/Book1.gnm.unzipped
235
236 CLEANFILES += *.save pspp.* foo*
237
238 check-for-export-var-val:
239         @if grep -q 'export .*=' $(dist_TESTS) ; then \
240          echo 'One or more tests contain non-portable "export VAR=val" syntax' ; \
241          false ; \
242         fi
243
244 DIST_HOOKS += check-for-export-var-val
245
246 EXTRA_DIST += tests/OChangeLog
247 \f
248 # Autotest testsuite
249
250 EXTRA_DIST += \
251         tests/testsuite.in \
252         $(TESTSUITE_AT) \
253         $(TESTSUITE) \
254         tests/atlocal.in \
255         $(srcdir)/package.m4 \
256         $(TESTSUITE)
257
258 TESTSUITE_AT = \
259         tests/data/calendar.at \
260         tests/data/data-in.at \
261         tests/data/data-out.at \
262         tests/data/datasheet-test.at \
263         tests/data/format-guesser.at \
264         tests/data/por-file.at \
265         tests/data/sys-file.at \
266         tests/language/command.at \
267         tests/language/control/do-if.at \
268         tests/language/control/do-repeat.at \
269         tests/language/control/loop.at \
270         tests/language/control/temporary.at \
271         tests/language/data-io/add-files.at \
272         tests/language/data-io/data-list.at \
273         tests/language/data-io/data-reader.at \
274         tests/language/data-io/file-handle.at \
275         tests/language/data-io/get-data-gnm.at \
276         tests/language/data-io/get-data-psql.at \
277         tests/language/data-io/get-data-txt.at \
278         tests/language/data-io/get.at \
279         tests/language/data-io/inpt-pgm.at \
280         tests/language/data-io/list.at \
281         tests/language/data-io/match-files.at \
282         tests/language/data-io/print.at \
283         tests/language/data-io/save.at \
284         tests/language/data-io/save-translate.at \
285         tests/language/data-io/update.at \
286         tests/language/dictionary/attributes.at \
287         tests/language/dictionary/missing-values.at \
288         tests/language/dictionary/mrsets.at \
289         tests/language/dictionary/rename-variables.at \
290         tests/language/dictionary/split-file.at \
291         tests/language/dictionary/sys-file-info.at \
292         tests/language/dictionary/value-labels.at \
293         tests/language/dictionary/variable-display.at \
294         tests/language/dictionary/vector.at \
295         tests/language/dictionary/weight.at \
296         tests/language/expressions/evaluate.at \
297         tests/language/expressions/parse.at \
298         tests/language/lexer/lexer.at \
299         tests/language/lexer/q2c.at \
300         tests/language/lexer/variable-parser.at \
301         tests/language/stats/aggregate.at \
302         tests/language/stats/autorecode.at \
303         tests/language/stats/correlations.at \
304         tests/language/stats/crosstabs.at \
305         tests/language/stats/descriptives.at \
306         tests/language/stats/examine.at \
307         tests/language/stats/factor.at \
308         tests/language/stats/flip.at \
309         tests/language/stats/frequencies.at \
310         tests/language/stats/npar.at \
311         tests/language/stats/oneway.at \
312         tests/language/stats/rank.at \
313         tests/language/stats/regression.at \
314         tests/language/stats/reliability.at \
315         tests/language/stats/roc.at \
316         tests/language/stats/sort-cases.at \
317         tests/language/stats/t-test.at \
318         tests/language/utilities/date.at \
319         tests/language/utilities/insert.at \
320         tests/language/utilities/permissions.at \
321         tests/language/utilities/set.at \
322         tests/language/utilities/title.at \
323         tests/language/xforms/compute.at \
324         tests/language/xforms/count.at \
325         tests/language/xforms/recode.at \
326         tests/language/xforms/sample.at \
327         tests/language/xforms/select-if.at \
328         tests/libpspp/abt.at \
329         tests/libpspp/bt.at \
330         tests/libpspp/float-format.at \
331         tests/libpspp/heap.at \
332         tests/libpspp/hmap.at \
333         tests/libpspp/hmapx.at \
334         tests/libpspp/i18n.at \
335         tests/libpspp/ll.at \
336         tests/libpspp/llx.at \
337         tests/libpspp/range-map.at \
338         tests/libpspp/range-set.at \
339         tests/libpspp/sparse-array.at \
340         tests/libpspp/sparse-xarray-test.at \
341         tests/libpspp/str.at \
342         tests/libpspp/string-map.at \
343         tests/libpspp/stringi-map.at \
344         tests/libpspp/string-set.at \
345         tests/libpspp/stringi-set.at \
346         tests/libpspp/tower.at \
347         tests/math/moments.at \
348         tests/math/randist.at \
349         tests/output/charts.at \
350         tests/output/output.at \
351         tests/output/paper-size.at \
352         tests/output/render.at \
353         tests/ui/terminal/main.at \
354         tests/perl-module.at
355
356 TESTSUITE = $(srcdir)/tests/testsuite
357 DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
358
359 $(srcdir)/tests/testsuite.at: tests/testsuite.in tests/automake.mk
360         cp $< $@
361         for t in $(TESTSUITE_AT); do \
362           echo "m4_include([$$t])" >> $@ ;\
363         done
364 EXTRA_DIST += tests/testsuite.at
365
366 CHECK_LOCAL += tests_check
367 tests_check: tests/atconfig tests/atlocal $(TESTSUITE) $(check_PROGRAMS)
368         $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/data:tests/libpspp:tests/output:src/ui/terminal $(TESTSUITEFLAGS)
369
370 CLEAN_LOCAL += tests_clean
371 tests_clean:
372         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
373
374 AUTOM4TE = $(SHELL) $(srcdir)/build-aux/missing --run autom4te
375 AUTOTEST = $(AUTOM4TE) --language=autotest
376 $(TESTSUITE): package.m4 $(srcdir)/tests/testsuite.at $(TESTSUITE_AT) 
377         $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
378         mv $@.tmp $@
379
380 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
381 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
382         :;{ \
383           echo '# Signature of the current package.' && \
384           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
385           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
386           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
387           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
388           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
389           echo 'm4_define([AT_PACKAGE_URL],       [$(PACKAGE_URL)])'; \
390         } >'$(srcdir)/package.m4'