01675aea8bab812e064114aa42a8ff2dc8246927
[pspp] / tests / bugs / computebug.sh
1 #!/bin/sh
2
3 # This program tests for a bug in the `compute' command
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 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 activity="copy file"
48 cp $top_srcdir/tests/bugs/computebug.stat $TEMPDIR
49 if [ $? -ne 0 ] ; then no_result ; fi
50
51 activity="chdir"
52 cd $TEMPDIR
53 if [ $? -ne 0 ] ; then no_result ; fi
54
55
56 activity="run program"
57 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/computebug.stat
58 if [ $? -ne 0 ] ; then no_result ; fi
59
60
61 activity="compare output"
62 diff -b -B -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/computebug.out
63 if [ $? -ne 0 ] ; then fail ; fi
64
65 pass;