0fea4abab773478415d6dbd94b36b84bb3e10981
[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      rm -rf $TEMPDIR
23 }
24
25
26 fail()
27 {
28     echo $activity
29     echo FAILED
30     cleanup;
31     exit 1;
32 }
33
34
35 no_result()
36 {
37     echo $activity
38     echo NO RESULT;
39     cleanup;
40     exit 2;
41 }
42
43 pass()
44 {
45     cleanup;
46     exit 0;
47 }
48
49 mkdir -p $TEMPDIR
50
51 cd $TEMPDIR
52
53 activity="delete data"
54 rm -f $TEMPDIR/large.dat
55 if [ $? -ne 0 ] ; then no_result ; fi
56
57 printf "Creating input data.  Please wait"
58 activity="create data"
59 ( while true ; do 
60         echo AB12;
61 done )  | head -100000 >> $TEMPDIR/large.dat
62 if [ $? -ne 0 ] ; then no_result ; fi
63 printf '.'
64 ( while true ; do 
65         echo AB04;
66 done )  | head -100000 >> $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 $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
84 if [ $? -ne 0 ] ; then fail ; fi
85
86 activity="appending to data"
87 # Put another 100,000 cases into large.dat
88 ( while true ; do 
89         echo AB04 
90         echo AB12 
91 done )  | head -50000 >> $TEMPDIR/large.dat
92 if [ $? -ne 0 ] ; then no_result ; fi
93
94 activity="run program"
95 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
96 if [ $? -ne 0 ] ; then fail ; fi
97
98 pass;