Update scripts that invoke Perl to invoke it as simply "perl" if
[pspp] / 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 : ${PERL:=perl}
11
12 # ensure that top_builddir  are absolute
13 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
14 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
15 top_builddir=`cd $top_builddir; pwd`
16 PSPP=$top_builddir/src/ui/terminal/pspp
17
18 # ensure that top_srcdir is absolute
19 top_srcdir=`cd $top_srcdir; pwd`
20
21 STAT_CONFIG_PATH=$top_srcdir/config
22 export STAT_CONFIG_PATH
23
24
25 cleanup()
26 {
27      cd /
28      rm -rf $TEMPDIR
29 }
30
31
32 fail()
33 {
34     echo $activity
35     echo FAILED
36     cleanup;
37     exit 1;
38 }
39
40
41 no_result()
42 {
43     echo $activity
44     echo NO RESULT;
45     cleanup;
46     exit 2;
47 }
48
49 pass()
50 {
51     cleanup;
52     exit 0;
53 }
54
55 mkdir -p $TEMPDIR
56
57 cd $TEMPDIR
58
59 activity="delete data"
60 rm -f $TEMPDIR/large.dat
61 if [ $? -ne 0 ] ; then no_result ; fi
62
63 printf "Creating input data.  Please wait"
64 activity="create data"
65 $PERL -e 'for ($i=0; $i<100000; $i++) { print "AB12\n" };
66           for ($i=0; $i<100000; $i++) { print "AB04\n" };' > $TEMPDIR/large.dat
67 if [ $? -ne 0 ] ; then no_result ; fi
68 printf ".\n";
69
70 activity="create program"
71 cat > $TESTFILE <<EOF
72 DATA LIST FILE='$TEMPDIR/large.dat' /S 1-2 (A) X 3 .
73
74
75 AGGREGATE OUTFILE=* /BREAK=X /A=N.
76
77
78 EXAMINE /A BY /X.
79 EOF
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82 activity="run program"
83 $SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE 
84 if [ $? -ne 0 ] ; then fail ; fi
85
86 activity="appending to data"
87 # Put another 50,000 cases into large.dat
88 $PERL -e 'for ($i=0; $i<25000; $i++) { print "AB04\nAB12\n" };' >> $TEMPDIR/large.dat
89 if [ $? -ne 0 ] ; then no_result ; fi
90
91 activity="run program"
92 $SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE 
93 if [ $? -ne 0 ] ; then fail ; fi
94
95 pass;