Properly handle empty DO REPEAT...END REPEAT block. Fixes bug #18407.
[pspp-builds.git] / tests / bugs / html-frequency.sh
1 #!/bin/sh
2
3 # This program tests for a bug where pspp would crash 
4 # when a FREQUENCIES command was used with the html 
5 # driver.
6
7
8 TEMPDIR=/tmp/pspp-tst-$$
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 cd $top_srcdir ; top_srcdir=`pwd`
19
20 STAT_CONFIG_PATH=$top_srcdir/config
21 export STAT_CONFIG_PATH
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
56 activity="create data"
57 cat << EOF > $TESTFILE
58
59 data list free /v1 v2.
60 begin data.
61 0 1
62 2 3 
63 4 5
64 3 4
65 end data.
66
67 list.
68
69 frequencies v1 v2.
70 EOF
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73 cd $TEMPDIR
74
75 activity="run data"
76 $SUPERVISOR $PSPP -o html $TESTFILE
77 if [ $? -ne 0 ] ; then fail ; fi
78
79
80 pass;