9d153007eea8eea67fe19996e0f09b16a2b5fac8
[pspp-builds.git] / tests / bugs / big-input-2.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused  a crash when 
4 # very large files are presented.
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9 TESTFILE=$TEMPDIR/`basename $0`.sps
10
11 here=`pwd`;
12
13 # ensure that top_srcdir is absolute
14 cd $top_srcdir; top_srcdir=`pwd`
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19
20 cleanup()
21 {
22      cd /
23      rm -rf $TEMPDIR
24 }
25
26
27 fail()
28 {
29     echo $activity
30     echo FAILED
31     cleanup;
32     exit 1;
33 }
34
35
36 no_result()
37 {
38     echo $activity
39     echo NO RESULT;
40     cleanup;
41     exit 2;
42 }
43
44 pass()
45 {
46     cleanup;
47     exit 0;
48 }
49
50 mkdir -p $TEMPDIR
51
52 cd $TEMPDIR
53
54 activity="delete data"
55 rm -f $TEMPDIR/large.dat
56 if [ $? -ne 0 ] ; then no_result ; fi
57
58 printf "Creating input data.  Please wait"
59 activity="create data"
60 $PERL -e 'for ($i=0; $i<100000; $i++) { print "AB12\n" };
61           for ($i=0; $i<100000; $i++) { print "AB04\n" };' > $TEMPDIR/large.dat
62 if [ $? -ne 0 ] ; then no_result ; fi
63 printf ".\n";
64
65 activity="create program"
66 cat > $TESTFILE <<EOF
67 DATA LIST FILE='$TEMPDIR/large.dat' /S 1-2 (A) X 3 .
68
69
70 AGGREGATE OUTFILE=* /BREAK=X /A=N.
71
72
73 EXAMINE /A BY /X.
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77 activity="run program"
78 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
79 if [ $? -ne 0 ] ; then fail ; fi
80
81 activity="appending to data"
82 # Put another 50,000 cases into large.dat
83 $PERL -e 'for ($i=0; $i<25000; $i++) { print "AB04\nAB12\n" };' >> $TEMPDIR/large.dat
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86 activity="run program"
87 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
88 if [ $? -ne 0 ] ; then fail ; fi
89
90 pass;