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