Merge commit 'origin/stable'
[pspp-builds.git] / tests / bugs / examine-crash2.sh
1 #!/bin/sh
2
3 # This program tests for a bug which crashed pspp
4 # when two consecutive EXAMINE commands are run.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_srcdir and top_builddir  are absolute
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 top_srcdir=`cd $top_srcdir; pwd`
13 top_builddir=`cd $top_builddir; pwd`
14
15 PSPP=$top_builddir/src/ui/terminal/pspp
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR"
28         return ; 
29      fi
30      rm -rf $TEMPDIR
31 }
32
33
34 fail()
35 {
36     echo $activity
37     echo FAILED
38     cleanup;
39     exit 1;
40 }
41
42
43 no_result()
44 {
45     echo $activity
46     echo NO RESULT;
47     cleanup;
48     exit 2;
49 }
50
51 pass()
52 {
53     cleanup;
54     exit 0;
55 }
56
57 mkdir -p $TEMPDIR
58
59 cd $TEMPDIR
60
61 cat <<EOF > $TESTFILE
62 data list list /y * z *.
63 begin data.
64 6 4
65 5 3
66 7 6
67 end data.
68
69 EXAMINE /VARIABLES= z BY y.
70
71 EXAMINE /VARIABLES= z. 
72 EOF
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75
76 activity="run program"
77 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
78 if [ $? -ne 0 ] ; then fail ; fi
79
80
81 pass;