3 # This program tests that signals are properly caught and handled by PSPP
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
31 # Kill any remaining children of this shell
32 kill `ps h --ppid $$ | awk '{print $1}'` 2> /dev/null
64 activity="run program in interactive mode"
65 cat | $PSPP --testing-mode -o raw-ascii 2> $TEMPDIR/stderr1 > /dev/null &
67 if [ $? -ne 0 ] ; then no_result ; fi
69 activity="run program in interactive mode 2"
70 cat | $PSPP --testing-mode -o raw-ascii 2> $TEMPDIR/stderr2 > /dev/null &
72 if [ $? -ne 0 ] ; then no_result ; fi
74 # This one is a dummy. Despite the sleep command, it may not be enought
75 # to ensure that the preceeding pspp has actually initialised itself.
76 activity="run program in interactive mode 3"
77 cat | $PSPP --testing-mode -o raw-ascii 2> /dev/null > /dev/null & sleep 1
79 if [ $? -ne 0 ] ; then no_result ; fi
81 activity="sending SIGINT to pspp1"
83 if [ $? -ne 0 ] ; then no_result ; fi
85 activity="sending SIGSEGV to pspp2"
87 if [ $? -ne 0 ] ; then no_result ; fi
90 # SIGINT should have caused a clean shutdown
92 activity="checking for absence of error messages 1"
93 [ ! -s $TEMPDIR/stderr1 ]
94 if [ $? -ne 0 ] ; then fail ; fi
96 # SIGSEGV should have caused an error message
98 activity="checking for error messages from pspp 2"
99 head -8 $TEMPDIR/stderr2 > $TEMPDIR/stderr-head
100 if [ $? -ne 0 ] ; then no_result ; fi
102 activity="comparing error messages from pspp 2"
103 diff $TEMPDIR/stderr-head - << EOF
104 ******************************************************
105 You have discovered a bug in PSPP. Please report this
106 to bug-gnu-pspp@gnu.org. Please include this entire
107 message, *plus* several lines of output just above it.
108 For the best chance at having the bug fixed, also
109 include the syntax file that triggered it and a sample
110 of any data file used for input.
111 proximate cause: Segmentation Violation
113 if [ $? -ne 0 ] ; then fail ; fi