eada06b7b463967236c2ca4e3e0b99429fc04766
[pspp-builds.git] / tests / bugs / compute-fmt.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused a crash after SAVE FILE
4 # was called on a COMPUTEd variable
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 here=`pwd`;
11
12 # ensure that top_srcdir is absolute
13 cd $top_srcdir; top_srcdir=`pwd`
14
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
17
18
19 cleanup()
20 {
21      rm -rf $TEMPDIR
22 }
23
24
25 fail()
26 {
27     echo $activity
28     echo FAILED
29     cleanup;
30     exit 1;
31 }
32
33
34 no_result()
35 {
36     echo $activity
37     echo NO RESULT;
38     cleanup;
39     exit 2;
40 }
41
42 pass()
43 {
44     cleanup;
45     exit 0;
46 }
47
48 mkdir -p $TEMPDIR
49
50 cd $TEMPDIR
51
52 activity="create program"
53 cat > $TEMPDIR/foo.sps <<EOF
54 INPUT PROGRAM.
55         COMPUTE num = 3.
56 END FILE.
57 END INPUT PROGRAM.
58 EXECUTE.
59
60 SAVE outfile='$TEMPDIR/temp.sav'.
61 EOF
62 if [ $? -ne 0 ] ; then no_result ; fi
63
64 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/foo.sps
65 if [ $? -ne 0 ] ; then fail; fi
66
67
68
69 pass;