Fix missing @clicksequence problem with older Texinfo versions.
[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 # ensure that top_builddir  are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
13
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR" 
28         return ; 
29      fi
30      cd /
31      rm -rf $TEMPDIR
32 }
33
34
35 fail()
36 {
37     echo $activity
38     echo FAILED
39     cleanup;
40     exit 1;
41 }
42
43
44 no_result()
45 {
46     echo $activity
47     echo NO RESULT;
48     cleanup;
49     exit 2;
50 }
51
52 pass()
53 {
54     cleanup;
55     exit 0;
56 }
57
58 mkdir -p $TEMPDIR
59
60 cd $TEMPDIR
61
62 activity="create program"
63 cat > $TEMPDIR/split.stat <<EOF
64 title 'Test SPLIT FILE utility'.
65
66 data list notable /X 1 Y 2.
67 begin data.
68 12
69 16
70 17
71 19
72 15
73 14
74 27
75 20
76 26
77 25
78 28
79 29
80 24
81 end data.
82 split file by x.
83 list.
84 EOF
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87 activity="run program"
88 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/split.stat
89 if [ $? -ne 0 ] ; then no_result ; fi
90
91 activity="compare results"
92 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
93 diff  -b $TEMPDIR/pspp.list - <<EOF
94 Variable Value Label
95 X            1
96 X Y
97 - -
98 1 2 
99 1 6 
100 1 7 
101 1 9 
102 1 5 
103 1 4 
104 Variable Value Label
105 X            2
106 X Y
107 - -
108 2 7 
109 2 0 
110 2 6 
111 2 5 
112 2 8 
113 2 9 
114 2 4
115 EOF
116 if [ $? -ne 0 ] ; then fail ; fi
117
118 pass;