1dnl PSPP - a program for statistical analysis.
2dnl Copyright (C) 2017 Free Software Foundation, Inc.
3dnl
4dnl This program is free software: you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation, either version 3 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16dnl
17AT_BANNER([PSPP terminal UI])
18
19AT_SETUP([nonexistent syntax file crash])
20AT_CHECK([pspp nonexistent], [1],
21  [error: Opening `nonexistent': No such file or directory.
22])
23AT_CLEANUP
24
25AT_SETUP([SIGTERM yields clean shutdown])
26AT_KEYWORDS([slow])
27AT_DATA([main.sps], [dnl
28INPUT PROGRAM.
29COMPUTE x = x + 1.
30DO IF x = 10000.
31END CASE.
32ELSE IF x < 0.
33END FILE.
34END IF.
35END INPUT PROGRAM.
36EXECUTE.
37])
38AT_CHECK([pspp main.sps & sleep 1; kill $!; wait $!], [143], [], [ignore])
39AT_CLEANUP
40
41AT_SETUP([SIGSEGV yields error report])
42
43# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
44ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
45
46AT_CHECK([[echo 'host command=["kill -SEGV $PPID"].' | pspp -O format=csv]],
47  [139], [], [stderr])
48
49cat > expout <<EOF
50******************************************************
51You have discovered a bug in PSPP.  Please report this
52to $PACKAGE_BUGREPORT.  Please include this entire
53message, *plus* several lines of output just above it.
54For the best chance at having the bug fixed, also
55include the syntax file that triggered it and a sample
56of any data file used for input.
57proximate cause:     Segmentation Violation
58EOF
59
60AT_CHECK([sed '/proximate/q' < stderr], [0], [expout])
61AT_CLEANUP
62
63
64dnl This tests for a crash which was observed with --syntax
65AT_SETUP([argument parsing])
66
67AT_DATA([main.sps], [dnl
68ECHO 'This is a test'.
69FINISH.
70])
71
72AT_CHECK([pspp --syntax=enhanced main.sps], [0], [ignore])
73
74AT_CLEANUP
75