c7b8906c5f4fdba8812302932d27210d3ae1932e
[pspp-builds.git] / tests / xforms / casefile.sh
1 #!/bin/sh
2
3 # This program tests casefiles by running DEBUG CASEFILE.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 STAT_CONFIG_PATH=$top_srcdir/config
13 export STAT_CONFIG_PATH
14
15
16 cleanup()
17 {
18      cd /
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/casefile.stat <<EOF
52 DEBUG CASEFILE SMALL.
53 EOF
54 if [ $? -ne 0 ] ; then no_result ; fi
55
56 activity="run program"
57 $SUPERVISOR $here/../src/pspp --testing-mode $TEMPDIR/casefile.stat > $TEMPDIR/casefile.out
58 if [ $? -ne 0 ] ; then no_result ; fi
59
60 activity="compare results"
61 perl -pi -e 's/^\s*$//g' $TEMPDIR/casefile.out
62 diff -b $TEMPDIR/casefile.out - <<EOF
63 Casefile tests succeeded.
64 EOF
65
66 if [ $? -ne 0 ] ; then no_result ; fi
67
68
69 if [ $? -ne 0 ] ; then fail ; fi
70
71
72
73 pass;