Fix use of "export" to work with traditional shells.
[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 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      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
22         echo "NOT cleaning $TEMPDIR"
23         return ; 
24      fi
25      rm -rf $TEMPDIR
26 }
27
28
29 fail()
30 {
31     echo $activity
32     echo FAILED
33     cleanup;
34     exit 1;
35 }
36
37
38 no_result()
39 {
40     echo $activity
41     echo NO RESULT;
42     cleanup;
43     exit 2;
44 }
45
46 pass()
47 {
48     cleanup;
49     exit 0;
50 }
51
52 mkdir -p $TEMPDIR
53
54 cd $TEMPDIR
55
56 activity="create program"
57 cat <<EOF > $TESTFILE
58 GET FILE='$top_srcdir/tests/no_case_size.sav'.
59 DISPLAY DICTIONARY.
60 LIST.
61 EOF
62 if [ $? -ne 0 ] ; then no_result ; fi
63
64
65 activity="run program"
66 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
67 if [ $? -ne 0 ] ; then no_result ; fi
68
69 activity="compare output"
70 diff -b -B -w pspp.list - <<EOF
71 1.1 DISPLAY.  
72 +--------+-------------------------------------------+--------+
73 |Variable|Description                                |Position|
74 #========#===========================================#========#
75 |CONT    |continents of the world                    |       1|
76 |        |Format: A32                                |        |
77 +--------+-------------------------------------------+--------+
78 |SIZE    |sq km                                      |       2|
79 |        |Format: F8.2                               |        |
80 +--------+-------------------------------------------+--------+
81 |POP     |population                                 |       3|
82 |        |Format: F8.2                               |        |
83 +--------+-------------------------------------------+--------+
84 |COUNT   |number of countries                        |       4|
85 |        |Format: F8.2                               |        |
86 +--------+-------------------------------------------+--------+
87
88                             CONT     SIZE      POP    COUNT
89 -------------------------------- -------- -------- --------
90 Asia                             44579000 3.67E+09    44.00 
91 Africa                           30065000 7.78E+08    53.00 
92 North America                    24256000 4.83E+08    23.00 
93 South America                    17819000 3.42E+08    12.00 
94 Antarctica                       13209000      .00      .00 
95 Europe                            9938000 7.32E+08    46.00 
96 Australia/Oceania                 7687000 31000000    14.00 
97
98 EOF
99 if [ $? -ne 0 ] ; then fail ; fi
100
101
102 pass;