Greatly simplify PSPP configuration.
[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      cd /
31      rm -rf $TEMPDIR
32 }
33
34
35 fail()
36 {
37     echo $activity
38     echo FAILED
39     cleanup;
40     exit 1;
41 }
42
43
44 no_result()
45 {
46     echo $activity
47     echo NO RESULT;
48     cleanup;
49     exit 2;
50 }
51
52 pass()
53 {
54     cleanup;
55     exit 0;
56 }
57
58 mkdir -p $TEMPDIR
59
60 cd $TEMPDIR
61
62 activity="create script"
63 cat > $TESTFILE  <<EOF
64 DATA LIST LIST /x * w *.
65 BEGIN DATA.
66 1 4
67 2 2
68 END DATA.
69
70 WEIGHT BY w.
71
72 FREQUENCIES x
73   /FORMAT=nolabels
74   .
75 EOF
76 if [ $? -ne 0 ] ; then no_result ; fi
77
78
79 activity="run program"
80 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE
81 if [ $? -ne 0 ] ; then no_result ; fi
82
83
84
85 pass;