687993053e5e89f57f2b16a00f627a2a4a376c6b
[pspp] / tests / bugs / alpha-freq.sh
1 #!/bin/sh
2
3 # This program tests for a bug where the FREQUENCIES command would 
4 # crash if given an alphanumeric variable
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_builddir  are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13 PSPP=$top_builddir/src/ui/terminal/pspp
14
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
17
18 STAT_CONFIG_PATH=$top_srcdir/config
19 export STAT_CONFIG_PATH
20
21 LANG=C
22 export LANG
23
24 cleanup()
25 {
26      cd /
27      rm -rf $TEMPDIR
28 }
29
30
31 fail()
32 {
33     echo $activity
34     echo FAILED
35     cleanup;
36     exit 1;
37 }
38
39
40 no_result()
41 {
42     echo $activity
43     echo NO RESULT;
44     cleanup;
45     exit 2;
46 }
47
48 pass()
49 {
50     cleanup;
51     exit 0;
52 }
53
54 mkdir -p $TEMPDIR
55
56 cd $TEMPDIR
57
58 cat > $TEMPDIR/prog.sps <<EOF
59 DATA LIST FREE/
60    name  (A8) value * quantity .
61 BEGIN DATA.
62 Cables 829 3 
63 END DATA.
64 EXECUTE.
65
66 FREQUENCIES /VAR = name.
67
68 EOF
69 if [ $? -ne 0 ] ; then no_result ; fi
70
71
72 $SUPERVISOR $PSPP $TEMPDIR/prog.sps
73 if [ $? -ne 0 ] ; then fail ; fi
74
75
76 pass;