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