Fix use of "export" to work with traditional shells.
[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      rm -rf $TEMPDIR
22 }
23
24
25 fail()
26 {
27     echo $activity
28     echo FAILED
29     cleanup;
30     exit 1;
31 }
32
33
34 no_result()
35 {
36     echo $activity
37     echo NO RESULT;
38     cleanup;
39     exit 2;
40 }
41
42 pass()
43 {
44     cleanup;
45     exit 0;
46 }
47
48 mkdir -p $TEMPDIR
49
50 cd $TEMPDIR
51
52 activity="create program"
53 cat > $TEMPDIR/foo.sps <<EOF
54 INPUT PROGRAM.
55         LOOP #I=1 TO 50000.
56                 COMPUTE X=NORMAL(10).
57                 END CASE.
58         END LOOP.
59         END FILE.
60 END INPUT PROGRAM.
61
62
63 EXAMINE /x
64         /STATISTICS=DESCRIPTIVES.
65 EOF
66 if [ $? -ne 0 ] ; then no_result ; fi
67
68 activity="run program"
69 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/foo.sps > /dev/null
70 if [ $? -ne 0 ] ; then fail ; fi
71
72 pass;