pspp-convert: Fix crash when the output file cannot be created.
[pspp] / tests / automake.mk
1 # PSPP - a program for statistical analysis.
2 # Copyright (C) 2017 Free Software Foundation, Inc.
3
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
18
19 check_PROGRAMS += \
20         tests/data/datasheet-test \
21         tests/data/sack \
22         tests/data/inexactify \
23         tests/language/lexer/command-name-test \
24         tests/language/lexer/scan-test \
25         tests/language/lexer/segment-test \
26         tests/libpspp/abt-test \
27         tests/libpspp/bt-test \
28         tests/libpspp/cmac-aes256-test \
29         tests/libpspp/encoding-guesser-test \
30         tests/libpspp/heap-test \
31         tests/libpspp/hmap-test \
32         tests/libpspp/hmapx-test \
33         tests/libpspp/i18n-test \
34         tests/libpspp/line-reader-test \
35         tests/libpspp/ll-test \
36         tests/libpspp/llx-test \
37         tests/libpspp/range-map-test \
38         tests/libpspp/range-set-test \
39         tests/libpspp/range-tower-test \
40         tests/libpspp/sparse-array-test \
41         tests/libpspp/sparse-xarray-test \
42         tests/libpspp/str-test \
43         tests/libpspp/string-map-test \
44         tests/libpspp/stringi-map-test \
45         tests/libpspp/string-set-test \
46         tests/libpspp/stringi-set-test \
47         tests/libpspp/tower-test \
48         tests/libpspp/u8-istream-test \
49         tests/libpspp/zip-test \
50         tests/math/chart-get-ticks-format-test \
51         tests/math/chart-get-scale-test \
52         tests/output/render-test \
53         tests/ui/syntax-gen-test
54
55
56 check-programs: $(check_PROGRAMS)
57
58 tests_data_datasheet_test_SOURCES = \
59         tests/data/datasheet-test.c
60 tests_data_datasheet_test_LDADD = src/libpspp-core.la
61 tests_data_datasheet_test_CFLAGS = $(AM_CFLAGS)
62
63 tests_data_sack_SOURCES = \
64         tests/data/sack.c
65 tests_data_sack_LDADD = src/libpspp-core.la 
66 tests_data_sack_CFLAGS = $(AM_CFLAGS)
67
68 tests_libpspp_line_reader_test_SOURCES = tests/libpspp/line-reader-test.c
69 tests_libpspp_line_reader_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
70
71 tests_libpspp_ll_test_SOURCES = \
72         src/libpspp/ll.c \
73         tests/libpspp/ll-test.c
74 tests_libpspp_ll_test_CFLAGS = $(AM_CFLAGS)
75
76 tests_libpspp_llx_test_SOURCES = \
77         src/libpspp/ll.c \
78         src/libpspp/llx.c \
79         tests/libpspp/llx-test.c
80 tests_libpspp_llx_test_CFLAGS = $(AM_CFLAGS)
81
82 tests_libpspp_encoding_guesser_test_SOURCES = \
83         tests/libpspp/encoding-guesser-test.c
84 tests_libpspp_encoding_guesser_test_LDADD = \
85         src/libpspp/liblibpspp.la \
86         gl/libgl.la
87
88 tests_libpspp_heap_test_SOURCES = \
89         tests/libpspp/heap-test.c
90 tests_libpspp_heap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
91 tests_libpspp_heap_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
92
93 tests_libpspp_hmap_test_SOURCES = \
94         src/libpspp/hmap.c \
95         tests/libpspp/hmap-test.c
96 tests_libpspp_hmap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
97
98 tests_libpspp_hmapx_test_SOURCES = \
99         src/libpspp/hmap.c \
100         src/libpspp/hmapx.c \
101         tests/libpspp/hmapx-test.c
102 tests_libpspp_hmapx_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
103
104 tests_libpspp_i18n_test_SOURCES = tests/libpspp/i18n-test.c
105 tests_libpspp_i18n_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la 
106
107 tests_libpspp_abt_test_SOURCES = \
108         src/libpspp/abt.c \
109         tests/libpspp/abt-test.c
110 tests_libpspp_abt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
111
112 tests_libpspp_bt_test_SOURCES = \
113         src/libpspp/bt.c \
114         tests/libpspp/bt-test.c
115 tests_libpspp_bt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
116
117 tests_libpspp_cmac_aes256_test_SOURCES = \
118         src/libpspp/cmac-aes256.c \
119         tests/libpspp/cmac-aes256-test.c
120 tests_libpspp_cmac_aes256_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
121
122 tests_libpspp_range_map_test_SOURCES = \
123         src/libpspp/bt.c \
124         src/libpspp/range-map.c \
125         tests/libpspp/range-map-test.c
126 tests_libpspp_range_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
127
128 tests_libpspp_range_set_test_SOURCES = \
129         tests/libpspp/range-set-test.c
130 tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
131 tests_libpspp_range_set_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
132
133 tests_libpspp_range_tower_test_SOURCES = \
134         tests/libpspp/range-tower-test.c
135 tests_libpspp_range_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
136 tests_libpspp_range_tower_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
137
138 tests_libpspp_str_test_SOURCES = \
139         tests/libpspp/str-test.c
140 tests_libpspp_str_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la 
141
142 tests_libpspp_string_map_test_SOURCES = \
143         tests/libpspp/string-map-test.c
144 tests_libpspp_string_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
145 tests_libpspp_string_map_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
146
147 tests_libpspp_stringi_map_test_SOURCES = \
148         tests/libpspp/stringi-map-test.c
149 tests_libpspp_stringi_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
150 tests_libpspp_stringi_map_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
151
152 tests_libpspp_string_set_test_SOURCES = \
153         src/libpspp/hash-functions.c \
154         src/libpspp/hmap.c \
155         src/libpspp/string-set.c \
156         tests/libpspp/string-set-test.c
157 tests_libpspp_string_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
158
159 tests_libpspp_stringi_set_test_SOURCES = \
160         tests/libpspp/stringi-set-test.c
161 tests_libpspp_stringi_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
162 tests_libpspp_stringi_set_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
163
164 tests_libpspp_tower_test_SOURCES = \
165         tests/libpspp/tower-test.c
166 tests_libpspp_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
167 tests_libpspp_tower_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
168
169 tests_libpspp_u8_istream_test_SOURCES = tests/libpspp/u8-istream-test.c
170 tests_libpspp_u8_istream_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
171
172 tests_libpspp_sparse_array_test_SOURCES = \
173         tests/libpspp/sparse-array-test.c 
174 tests_libpspp_sparse_array_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
175 tests_libpspp_sparse_array_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
176
177 tests_libpspp_sparse_xarray_test_SOURCES = \
178         tests/libpspp/sparse-xarray-test.c
179 tests_libpspp_sparse_xarray_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
180 tests_libpspp_sparse_xarray_test_LDADD = src/libpspp/liblibpspp.la \
181         src/libpspp-core.la \
182         gl/libgl.la 
183
184 tests_data_inexactify_SOURCES = tests/data/inexactify.c
185
186 check_PROGRAMS += tests/language/lexer/command-name-test
187 tests_language_lexer_command_name_test_SOURCES = \
188         src/data/identifier.c \
189         src/language/lexer/command-name.c \
190         tests/language/lexer/command-name-test.c
191 tests_language_lexer_command_name_test_LDADD = \
192         src/libpspp/liblibpspp.la \
193         gl/libgl.la 
194 tests_language_lexer_command_name_test_CFLAGS = $(AM_CFLAGS)
195
196 check_PROGRAMS += tests/language/lexer/scan-test
197 tests_language_lexer_scan_test_SOURCES = \
198         src/data/identifier.c \
199         src/language/lexer/command-name.c \
200         src/language/lexer/scan.c \
201         src/language/lexer/segment.c \
202         src/language/lexer/token.c \
203         tests/language/lexer/scan-test.c
204 tests_language_lexer_scan_test_CFLAGS = $(AM_CFLAGS)
205 tests_language_lexer_scan_test_LDADD = \
206         src/libpspp/liblibpspp.la \
207         gl/libgl.la 
208
209 check_PROGRAMS += tests/language/lexer/segment-test
210 tests_language_lexer_segment_test_SOURCES = \
211         src/data/identifier.c \
212         src/language/lexer/command-name.c \
213         src/language/lexer/segment.c \
214         tests/language/lexer/segment-test.c
215 tests_language_lexer_segment_test_CFLAGS = $(AM_CFLAGS)
216 tests_language_lexer_segment_test_LDADD = \
217         src/libpspp/liblibpspp.la \
218         gl/libgl.la 
219
220 check_PROGRAMS += tests/libpspp/zip-test
221 tests_libpspp_zip_test_SOURCES = \
222         tests/libpspp/zip-test.c
223
224 tests_libpspp_zip_test_CFLAGS = $(AM_CFLAGS)
225 tests_libpspp_zip_test_LDADD = \
226         src/libpspp/liblibpspp.la \
227         src/libpspp-core.la \
228         gl/libgl.la 
229
230 check_PROGRAMS += tests/math/chart-get-scale-test
231 tests_math_chart_get_scale_test_SOURCES = tests/math/chart-get-scale-test.c
232 tests_math_chart_get_scale_test_LDADD = \
233         src/math/libpspp-math.la \
234         src/libpspp/liblibpspp.la \
235         src/libpspp-core.la \
236         gl/libgl.la
237
238 check_PROGRAMS += tests/math/chart-get-ticks-format-test
239 tests_math_chart_get_ticks_format_test_SOURCES = tests/math/chart-get-ticks-format-test.c
240 tests_math_chart_get_ticks_format_test_LDADD = \
241         src/math/libpspp-math.la \
242         src/libpspp/liblibpspp.la \
243         src/libpspp-core.la \
244         gl/libgl.la
245
246 check_PROGRAMS += tests/output/render-test
247 tests_output_render_test_SOURCES = tests/output/render-test.c
248 tests_output_render_test_LDADD = \
249         src/libpspp.la \
250         src/libpspp-core.la \
251         $(CAIRO_LIBS)
252
253
254 check_PROGRAMS += tests/ui/syntax-gen-test
255 tests_ui_syntax_gen_test_SOURCES = tests/ui/syntax-gen-test.c
256 tests_ui_syntax_gen_test_LDADD = \
257         src/ui/libuicommon.la \
258         src/libpspp-core.la \
259         $(CAIRO_LIBS)
260
261
262 EXTRA_DIST += \
263         tests/coverage.sh \
264         tests/data/CVE-2017-10791.sav \
265         tests/data/CVE-2017-10792.sav \
266         tests/data/bcd-in.expected.cmp.gz \
267         tests/data/binhex-in.expected.cmp.gz \
268         tests/data/binhex-out.expected.gz \
269         tests/data/hotel-encrypted.sav \
270         tests/data/legacy-in.expected.cmp.gz \
271         tests/data/num-in.expected.gz \
272         tests/data/num-out-cmp.pl \
273         tests/data/num-out.expected.cmp.gz \
274         tests/data/v13.sav \
275         tests/data/v14.sav \
276         tests/data/test-encrypted.sps \
277         tests/language/mann-whitney.txt \
278         tests/language/data-io/Book1.gnm.unzipped \
279         tests/language/data-io/test.ods \
280         tests/language/data-io/newone.ods \
281         tests/language/stats/llz.zsav
282
283 CLEANFILES += *.save pspp.* foo*
284 \f
285 # Autotest testsuite
286
287 EXTRA_DIST += \
288         tests/testsuite.in \
289         $(TESTSUITE_AT) \
290         $(TESTSUITE) \
291         tests/atlocal.in \
292         $(srcdir)/package.m4 \
293         $(TESTSUITE)
294
295 TESTSUITE_AT = \
296         tests/data/calendar.at \
297         tests/data/data-in.at \
298         tests/data/data-out.at \
299         tests/data/datasheet-test.at \
300         tests/data/dictionary.at \
301         tests/data/file.at \
302         tests/data/format-guesser.at \
303         tests/data/pc+-file-reader.at \
304         tests/data/por-file.at \
305         tests/data/sys-file-reader.at \
306         tests/data/sys-file.at \
307         tests/data/encrypted-file.at \
308         tests/language/command.at \
309         tests/language/control/do-if.at \
310         tests/language/control/do-repeat.at \
311         tests/language/control/loop.at \
312         tests/language/control/temporary.at \
313         tests/language/data-io/add-files.at \
314         tests/language/data-io/data-list.at \
315         tests/language/data-io/data-reader.at \
316         tests/language/data-io/dataset.at \
317         tests/language/data-io/file-handle.at \
318         tests/language/data-io/get-data-spreadsheet.at \
319         tests/language/data-io/get-data-psql.at \
320         tests/language/data-io/get-data-txt.at \
321         tests/language/data-io/get.at \
322         tests/language/data-io/inpt-pgm.at \
323         tests/language/data-io/list.at \
324         tests/language/data-io/match-files.at \
325         tests/language/data-io/matrix-data.at \
326         tests/language/data-io/print-space.at \
327         tests/language/data-io/print.at \
328         tests/language/data-io/save.at \
329         tests/language/data-io/save-translate.at \
330         tests/language/data-io/update.at \
331         tests/language/dictionary/attributes.at \
332         tests/language/dictionary/delete-variables.at \
333         tests/language/dictionary/formats.at \
334         tests/language/dictionary/missing-values.at \
335         tests/language/dictionary/mrsets.at \
336         tests/language/dictionary/rename-variables.at \
337         tests/language/dictionary/sort-variables.at \
338         tests/language/dictionary/split-file.at \
339         tests/language/dictionary/sys-file-info.at \
340         tests/language/dictionary/value-labels.at \
341         tests/language/dictionary/variable-display.at \
342         tests/language/dictionary/vector.at \
343         tests/language/dictionary/weight.at \
344         tests/language/expressions/evaluate.at \
345         tests/language/expressions/parse.at \
346         tests/language/lexer/command-name.at \
347         tests/language/lexer/lexer.at \
348         tests/language/lexer/q2c.at \
349         tests/language/lexer/scan.at \
350         tests/language/lexer/segment.at \
351         tests/language/lexer/variable-parser.at \
352         tests/language/stats/aggregate.at \
353         tests/language/stats/autorecode.at \
354         tests/language/stats/correlations.at \
355         tests/language/stats/crosstabs.at \
356         tests/language/stats/descriptives.at \
357         tests/language/stats/examine.at \
358         tests/language/stats/graph.at \
359         tests/language/stats/factor.at \
360         tests/language/stats/flip.at \
361         tests/language/stats/frequencies.at \
362         tests/language/stats/glm.at \
363         tests/language/stats/logistic.at \
364         tests/language/stats/means.at \
365         tests/language/stats/npar.at \
366         tests/language/stats/oneway.at \
367         tests/language/stats/quick-cluster.at \
368         tests/language/stats/rank.at \
369         tests/language/stats/regression.at \
370         tests/language/stats/reliability.at \
371         tests/language/stats/roc.at \
372         tests/language/stats/sort-cases.at \
373         tests/language/stats/t-test.at \
374         tests/language/utilities/cache.at \
375         tests/language/utilities/cd.at \
376         tests/language/utilities/date.at \
377         tests/language/utilities/insert.at \
378         tests/language/utilities/permissions.at \
379         tests/language/utilities/set.at \
380         tests/language/utilities/show.at \
381         tests/language/utilities/title.at \
382         tests/language/xforms/compute.at \
383         tests/language/xforms/count.at \
384         tests/language/xforms/recode.at \
385         tests/language/xforms/sample.at \
386         tests/language/xforms/select-if.at \
387         tests/libpspp/abt.at \
388         tests/libpspp/bt.at \
389         tests/libpspp/encoding-guesser.at \
390         tests/libpspp/float-format.at \
391         tests/libpspp/heap.at \
392         tests/libpspp/hmap.at \
393         tests/libpspp/hmapx.at \
394         tests/libpspp/i18n.at \
395         tests/libpspp/line-reader.at \
396         tests/libpspp/ll.at \
397         tests/libpspp/llx.at \
398         tests/libpspp/range-map.at \
399         tests/libpspp/range-set.at \
400         tests/libpspp/range-tower.at \
401         tests/libpspp/sparse-array.at \
402         tests/libpspp/sparse-xarray-test.at \
403         tests/libpspp/str.at \
404         tests/libpspp/string-map.at \
405         tests/libpspp/stringi-map.at \
406         tests/libpspp/string-set.at \
407         tests/libpspp/stringi-set.at \
408         tests/libpspp/tower.at \
409         tests/libpspp/u8-istream.at \
410         tests/libpspp/zip.at \
411         tests/math/chart-geometry.at \
412         tests/math/moments.at \
413         tests/math/randist.at \
414         tests/output/ascii.at \
415         tests/output/charts.at \
416         tests/output/html.at \
417         tests/output/output.at \
418         tests/output/paper-size.at \
419         tests/output/render.at \
420         tests/output/tables.at \
421         tests/ui/terminal/main.at \
422         tests/ui/syntax-gen.at \
423         tests/utilities/pspp-convert.at \
424         tests/perl-module.at
425
426 TESTSUITE = $(srcdir)/tests/testsuite
427 DISTCLEANFILES += tests/atconfig tests/atlocal
428 AUTOTEST_PATH = tests/data:tests/language/lexer:tests/libpspp:tests/output:src/ui/terminal:utilities
429
430 $(srcdir)/tests/testsuite.at: tests/testsuite.in tests/automake.mk
431         $(AM_V_GEN)printf '\043 Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n' > $@,tmp
432         $(AM_V_at)cat $< >> $@,tmp
433         $(AM_V_at)for t in $(TESTSUITE_AT); do \
434           echo "m4_include([$$t])" >> $@,tmp ;\
435         done
436         mv $@,tmp $@
437
438 EXTRA_DIST += tests/testsuite.at
439
440 CHECK_LOCAL += tests_check
441 tests_check: tests/atconfig tests/atlocal $(TESTSUITE) $(check_PROGRAMS)
442         XTERM_LOCALE='' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) RUNNER='$(RUNNER)' $(TESTSUITEFLAGS)
443
444 CLEAN_LOCAL += tests_clean
445 tests_clean:
446         test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
447
448 AUTOM4TE = $(SHELL) $(srcdir)/build-aux/missing --run autom4te
449 AUTOTEST = $(AUTOM4TE) --language=autotest
450 $(TESTSUITE): package.m4 $(srcdir)/tests/testsuite.at $(TESTSUITE_AT) 
451         $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' $@.at | $(SED) 's/@<00A0>@/ /g' > $@.tmp
452         test -s $@.tmp
453         $(AM_V_at)mv $@.tmp $@
454
455 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
456 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
457         $(AM_V_GEN):;{ \
458           echo '# Signature of the current package.' && \
459           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
460           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
461           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
462           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
463           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
464           echo 'm4_define([AT_PACKAGE_URL],       [$(PACKAGE_URL)])'; \
465         } >'$(srcdir)/package.m4'
466
467 check-valgrind:
468         $(MAKE) check RUNNER='$(SHELL) $(abs_top_builddir)/libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20' TESTSUITEFLAGS='$(TESTSUITEFLAGS) -d'
469         @echo
470         @echo '--------------------------------'
471         @echo 'Valgrind output is in:'
472         @echo 'tests/testsuite.dir/*/valgrind.*'
473         @echo '--------------------------------'