Fix GCC 4.3 warning about uninitialized structure member.
[pspp] / tests / command / datasheet.sh
1 #!/bin/sh
2
3 # This program tests datasheet support.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 # ensure that top_builddir  are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
13
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23 cleanup()
24 {
25      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
26         echo "NOT cleaning $TEMPDIR" 
27         return ; 
28      fi
29      cd /
30      rm -rf $TEMPDIR
31 }
32
33
34 fail()
35 {
36     echo $activity
37     echo FAILED
38     cleanup;
39     exit 1;
40 }
41
42
43 no_result()
44 {
45     echo $activity
46     echo NO RESULT;
47     cleanup;
48     exit 2;
49 }
50
51 pass()
52 {
53     cleanup;
54     exit 0;
55 }
56
57 mkdir -p $TEMPDIR
58
59 cd $TEMPDIR
60
61 activity="Create File 1"
62 cat > $TESTFILE <<EOF
63 debug datasheet max=3,3 backing=0,0/progress=none/output=file("/dev/null").
64 debug datasheet max=3,3 backing=3,3/progress=none/output=file("/dev/null").
65 debug datasheet max=3,3 backing=3,1/progress=none/output=file("/dev/null").
66 debug datasheet max=3,3 backing=1,3/progress=none/output=file("/dev/null").
67 EOF
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70
71 activity="Run pspp 1"
72 $SUPERVISOR $PSPP --testing-mode $TESTFILE > datasheet.out
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75 activity="compare results"
76 diff -b  $TEMPDIR/datasheet.out - <<EOF
77 Datasheet test max(3,3) backing(0,0) successful.
78 Datasheet test max(3,3) backing(3,3) successful.
79 Datasheet test max(3,3) backing(3,1) successful.
80 Datasheet test max(3,3) backing(1,3) successful.
81 EOF
82 if [ $? -ne 0 ] ; then fail ; fi
83
84 pass;