2352a70f6f76fc1c2c461579c84bf67def1fc3c5
[pspp-builds.git] / tests / command / sysfiles.sh
1 #!/bin/sh
2
3 # This program tests that system files can be read and written 
4 # including the long variable names.
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      rm -rf $TEMPDIR
21 }
22
23
24 fail()
25 {
26     echo $activity
27     echo FAILED
28     cleanup;
29     exit 1;
30 }
31
32
33 no_result()
34 {
35     echo $activity
36     echo NO RESULT;
37     cleanup;
38     exit 2;
39 }
40
41 pass()
42 {
43     cleanup;
44     exit 0;
45 }
46
47 mkdir -p $TEMPDIR
48
49 cd $TEMPDIR
50
51 activity="create program"
52 cat > $TESTFILE <<EOF
53 DATA LIST LIST NOTABLE / variable001 * variable002 * variable003 * variable004 * .
54 BEGIN DATA.
55     1.00     1.00    1.0     2.00
56     1.00     1.00    2.0    30.00
57     1.00     2.00    1.0     8.00
58     1.00     2.00    2.0    20.00
59     2.00     1.00    1.0     2.00
60     2.00     1.00    2.0    22.00
61     2.00     2.00    1.0     1.00
62     2.00     2.00    2.0     3.00
63 END DATA.
64
65 SAVE /OUTFILE='$TEMPDIR/foo.sav'.
66
67 GET /FILE='$TEMPDIR/foo.sav'.
68
69 LIST.
70
71 EOF
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
77 if [ $? -ne 0 ] ; then no_result ; fi
78
79 activity="compare output"
80 diff -b -B -w $TEMPDIR/pspp.list - << EOF
81 variable001 variable002 variable003 variable004
82 ----------- ----------- ----------- -----------
83        1.00        1.00        1.00        2.00  
84        1.00        1.00        2.00       30.00 
85        1.00        2.00        1.00        8.00 
86        1.00        2.00        2.00       20.00 
87        2.00        1.00        1.00        2.00 
88        2.00        1.00        2.00       22.00 
89        2.00        2.00        1.00        1.00 
90        2.00        2.00        2.00        3.00 
91
92 EOF
93 if [ $? -ne 0 ] ; then fail ; fi
94
95 pass;