68bbd425d226b37867ea127c6f3245a8eba7e8d3
[pspp-builds.git] / tests / bugs / freq-nolabels.sh
1 #!/bin/sh
2
3 # This program tests for a bug which crashed frequencies when the
4 # /FORMAT=nolabels was given.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_srcdir and top_builddir  are absolute
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 top_srcdir=`cd $top_srcdir; pwd`
13 top_builddir=`cd $top_builddir; pwd`
14
15 PSPP=$top_builddir/src/ui/terminal/pspp
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR"
28         return ; 
29      fi
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 cd $TEMPDIR
60
61 activity="create script"
62 cat > $TESTFILE  <<EOF
63 DATA LIST LIST /x * w *.
64 BEGIN DATA.
65 1 4
66 2 2
67 END DATA.
68
69 WEIGHT BY w.
70
71 FREQUENCIES x
72   /FORMAT=nolabels
73   .
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="run program"
79 $SUPERVISOR $PSPP --testing-mode $TESTFILE
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82
83
84 pass;