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