2d1ade753174523590aa6414c44020ccbe373b92
[pspp-builds.git] / tests / bugs / big-input.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused a crash when 
4 # a large number of cases where presented.
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 here=`pwd`;
11
12 # ensure that top_srcdir is absolute
13 cd $top_srcdir; top_srcdir=`pwd`
14
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
17
18
19 cleanup()
20 {
21      cd /
22      rm -rf $TEMPDIR
23 }
24
25
26 fail()
27 {
28     echo $activity
29     echo FAILED
30     cleanup;
31     exit 1;
32 }
33
34
35 no_result()
36 {
37     echo $activity
38     echo NO RESULT;
39     cleanup;
40     exit 2;
41 }
42
43 pass()
44 {
45     cleanup;
46     exit 0;
47 }
48
49 mkdir -p $TEMPDIR
50
51 cd $TEMPDIR
52
53 activity="create program"
54 cat > $TEMPDIR/foo.sps <<EOF
55 INPUT PROGRAM.
56         LOOP #I=1 TO 50000.
57                 COMPUTE X=NORMAL(10).
58                 END CASE.
59         END LOOP.
60         END FILE.
61 END INPUT PROGRAM.
62
63
64 EXAMINE /x
65         /STATISTICS=DESCRIPTIVES.
66 EOF
67 if [ $? -ne 0 ] ; then no_result ; fi
68
69 activity="run program"
70 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/foo.sps > /dev/null
71 if [ $? -ne 0 ] ; then fail ; fi
72
73 pass;