Checkin of new directory structure.
[pspp-builds.git] / tests / command / no_case_size.sh
1 #!/bin/sh
2
3 # This program tests that system files can be read properly, even when the 
4 # case_size header value is -1 (Some 3rd party products do this)
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 # ensure that top_builddir  are absolute
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
13 top_builddir=`cd $top_builddir; pwd`
14
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
17
18 STAT_CONFIG_PATH=$top_srcdir/config
19 export STAT_CONFIG_PATH
20
21
22 cleanup()
23 {
24      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
25         echo "NOT cleaning $TEMPDIR"
26         return ; 
27      fi
28      cd /
29      rm -rf $TEMPDIR
30 }
31
32
33 fail()
34 {
35     echo $activity
36     echo FAILED
37     cleanup;
38     exit 1;
39 }
40
41
42 no_result()
43 {
44     echo $activity
45     echo NO RESULT;
46     cleanup;
47     exit 2;
48 }
49
50 pass()
51 {
52     cleanup;
53     exit 0;
54 }
55
56 mkdir -p $TEMPDIR
57
58 cd $TEMPDIR
59
60 activity="create program"
61 cat <<EOF > $TESTFILE
62 GET FILE='$top_srcdir/tests/no_case_size.sav'.
63 DISPLAY DICTIONARY.
64 LIST.
65 EOF
66 if [ $? -ne 0 ] ; then no_result ; fi
67
68
69 activity="run program"
70 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii $TESTFILE
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73 activity="compare output"
74 perl -pi -e 's/^\s*$//g' pspp.list
75 diff -b -w pspp.list - <<EOF
76 1.1 DISPLAY.  
77 +--------+-------------------------------------------+--------+
78 |Variable|Description                                |Position|
79 #========#===========================================#========#
80 |CONT    |continents of the world                    |       1|
81 |        |Format: A32                                |        |
82 +--------+-------------------------------------------+--------+
83 |SIZE    |sq km                                      |       2|
84 |        |Format: F8.2                               |        |
85 +--------+-------------------------------------------+--------+
86 |POP     |population                                 |       3|
87 |        |Format: F8.2                               |        |
88 +--------+-------------------------------------------+--------+
89 |COUNT   |number of countries                        |       4|
90 |        |Format: F8.2                               |        |
91 +--------+-------------------------------------------+--------+
92                             CONT     SIZE      POP    COUNT
93 -------------------------------- -------- -------- --------
94 Asia                             44579000 3.67E+09    44.00 
95 Africa                           30065000 7.78E+08    53.00 
96 North America                    24256000 4.83E+08    23.00 
97 South America                    17819000 3.42E+08    12.00 
98 Antarctica                       13209000      .00      .00 
99 Europe                            9938000 7.32E+08    46.00 
100 Australia/Oceania                 7687000 31000000    14.00 
101 EOF
102 if [ $? -ne 0 ] ; then fail ; fi
103
104
105 pass;