Fix use of "export" to work with traditional shells.
[pspp-builds.git] / tests / bugs / crosstabs.sh
1 #!/bin/sh
2
3 # This program tests for a bug which crashed pspp when doing a crosstabs
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TEMPDIR/ct.stat <<EOF
52 DATA LIST FIXED
53      / x   1-2
54        y   3
55        z   4.
56
57 BEGIN DATA.
58 0111 
59 0222 
60 0311 
61 0412 
62 0521 
63 0612 
64 0711 
65 0811 
66 0912 
67 END DATA.
68
69 LIST.
70
71
72 CROSSTABS TABLES  y by z.
73
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 $SUPERVISOR $here/../src/pspp $TEMPDIR/ct.stat
79 if [ $? -ne 0 ] ; then fail ; fi
80
81
82 pass;