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