Updated pspp-mode.el.
[pspp-builds.git] / tests / bugs / agg_crash.sh
1 #!/bin/sh
2
3 # This program tests for a bug which crashed pspp when doing a aggregate 
4 # procedure
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 here=`pwd`;
10
11 # ensure that top_srcdir is absolute
12 cd $top_srcdir; top_srcdir=`pwd`
13
14 export STAT_CONFIG_PATH=$top_srcdir/config
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TESTFILE <<EOF
52 INPUT PROGRAM.
53 LOOP c=1 TO 20.
54   COMPUTE x=UNIFORM(10)
55   END CASE.
56 END LOOP.
57 END FILE.
58 END INPUT PROGRAM.
59
60 AGGREGATE /BREAK=x .
61 EOF
62 if [ $? -ne 0 ] ; then no_result ; fi
63
64
65 # The above input is invalid.
66 # So this will have a non zero error status.
67 # But it shouldn't crash!
68 activity="run_program"
69 $SUPERVISOR $here/../src/pspp $TESTFILE > /dev/null
70 if [ $? -ne 1 ] ; then fail ; fi
71
72
73 pass;