Fixed some tests that were failing under cygwin
[pspp-builds.git] / tests / command / import-export.sh
1 #!/bin/sh
2
3 # This program tests the IMPORT and EXPORT commands
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="create program"
50 cat > $TESTFILE <<EOF
51 DATA LIST LIST /x * y *.
52 BEGIN DATA.
53 1 2
54 3 4
55 5 6
56 END DATA.
57
58 EXPORT /OUTFILE='wiz.por'.
59
60 LIST.
61
62 IMPORT /FILE='wiz.por'.
63
64 LIST.
65 EOF
66 if [ $? -ne 0 ] ; then no_result ; fi
67
68
69 activity="run program"
70 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73 activity="compare output"
74 diff -b -B $TEMPDIR/pspp.list - << EOF
75 1.1 DATA LIST.  Reading free-form data from the command file.
76 +--------+------+
77 |Variable|Format|
78 #========#======#
79 |X       |F8.0  |
80 |Y       |F8.0  |
81 +--------+------+
82
83        X        Y
84 -------- --------
85     1.00     2.00 
86     3.00     4.00 
87     5.00     6.00 
88
89        X        Y
90 -------- --------
91     1.00     2.00 
92     3.00     4.00 
93     5.00     6.00 
94
95 EOF
96 if [ $? -ne 0 ] ; then fail ; fi
97
98 pass;