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