789fe32c74766ade1f606d060375ce049ba50858
[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      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
26         echo "NOT cleaning $TEMPDIR" 
27         return ; 
28      fi
29      cd /
30      rm -rf $TEMPDIR
31 }
32
33
34 fail()
35 {
36     echo $activity
37     echo FAILED
38     cleanup;
39     exit 1;
40 }
41
42
43 no_result()
44 {
45     echo $activity
46     echo NO RESULT;
47     cleanup;
48     exit 2;
49 }
50
51 pass()
52 {
53     cleanup;
54     exit 0;
55 }
56
57 mkdir -p $TEMPDIR
58
59
60 activity="create data"
61 cat << EOF > $TESTFILE
62
63 data list free /v1 v2.
64 begin data.
65 0 1
66 2 3 
67 4 5
68 3 4
69 end data.
70
71 list.
72
73 frequencies v1 v2.
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77 cd $TEMPDIR
78
79 activity="run data"
80 $SUPERVISOR $PSPP -o html $TESTFILE
81 if [ $? -ne 0 ] ; then fail ; fi
82
83
84 pass;