d8e1893590fa5a96bbb8e909dacb5b4188eee0fb
[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 export STAT_CONFIG_PATH=$top_srcdir/config
16
17
18 cleanup()
19 {
20      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
21         echo "NOT cleaning $TEMPDIR"
22         return ; 
23      fi
24      rm -rf $TEMPDIR
25 }
26
27
28 fail()
29 {
30     echo $activity
31     echo FAILED
32     cleanup;
33     exit 1;
34 }
35
36
37 no_result()
38 {
39     echo $activity
40     echo NO RESULT;
41     cleanup;
42     exit 2;
43 }
44
45 pass()
46 {
47     cleanup;
48     exit 0;
49 }
50
51 mkdir -p $TEMPDIR
52
53 cd $TEMPDIR
54
55 cat <<EOF > $TESTFILE
56 GET FILE='$top_srcdir/tests/no_case_size.sav'.
57 DISPLAY DICTIONARY.
58 LIST.
59 EOF
60 if [ $? -ne 0 ] ; then no_result ; fi
61
62
63 activity="run program"
64 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE > /dev/null
65 if [ $? -ne 0 ] ; then no_result ; fi
66
67 activity="compare output"
68 diff -b -B -w pspp.list - <<EOF
69 1.1 DISPLAY.  
70 +--------+-------------------------------------------+--------+
71 |Variable|Description                                |Position|
72 #========#===========================================#========#
73 |CONT    |continents of the world                    |       1|
74 |        |Format: A32                                |        |
75 +--------+-------------------------------------------+--------+
76 |SIZE    |sq km                                      |       2|
77 |        |Format: F8.2                               |        |
78 +--------+-------------------------------------------+--------+
79 |POP     |population                                 |       3|
80 |        |Format: F8.2                               |        |
81 +--------+-------------------------------------------+--------+
82 |COUNT   |number of countries                        |       4|
83 |        |Format: F8.2                               |        |
84 +--------+-------------------------------------------+--------+
85
86                             CONT     SIZE      POP    COUNT
87 -------------------------------- -------- -------- --------
88 Asia    
89         
90         
91         
92
93 Africa  
94         
95         
96         
97
98 North Am
99 erica   
100         
101         
102
103 South Am
104 erica   
105         
106         
107
108 Antarcti
109 ca      
110         
111         
112
113 Europe  
114         
115         
116         
117
118 Australi
119 a/Oceani
120 a       
121         
122
123
124
125 EOF
126 if [ $? -ne 0 ] ; then fail ; fi
127
128
129 pass;