Fix use of "export" to work with traditional shells.
[pspp-builds.git] / tests / command / split-file.sh
1 #!/bin/sh
2
3 # This program tests the split file command
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 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TEMPDIR/split.stat <<EOF
52 title 'Test SPLIT FILE utility'.
53
54 data list notable /X 1 Y 2.
55 begin data.
56 12
57 16
58 17
59 19
60 15
61 14
62 27
63 20
64 26
65 25
66 28
67 29
68 24
69 end data.
70 split file by x.
71 list.
72 EOF
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/split.stat
77 if [ $? -ne 0 ] ; then no_result ; fi
78
79 activity="compare results"
80 diff -B -b $TEMPDIR/pspp.list - <<EOF
81 Variable Value Label
82 X            1
83
84 X Y
85 - -
86 1 2 
87 1 6 
88 1 7 
89 1 9 
90 1 5 
91 1 4 
92
93 Variable Value Label
94 X            2
95
96 X Y
97 - -
98 2 7 
99 2 0 
100 2 6 
101 2 5 
102 2 8 
103 2 9 
104 2 4
105 EOF
106 if [ $? -ne 0 ] ; then fail ; fi
107
108 pass;