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