3 # This program tests the MATCH FILES procedure
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/match-files.pspp
9 # ensure that top_builddir are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13 PSPP=$top_builddir/src/ui/terminal/pspp
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
19 STAT_CONFIG_PATH=$top_srcdir/config
20 export STAT_CONFIG_PATH
24 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
25 echo "NOT cleaning $TEMPDIR"
60 activity="data create"
76 if [ $? -ne 0 ] ; then no_result ; fi
85 if [ $? -ne 0 ] ; then no_result ; fi
88 A B C D INA INB FIRST LAST
89 - - - - --- --- ----- ----
107 A B C D INA INB FIRST LAST
108 - - - - --- --- ----- ----
124 # Test nonparallel match and table lookup.
125 dla="data list notable file='a.data' /A B C 1-3 (a)."
126 sa="save outfile='a.sys'."
127 dlb="data list notable file='b.data' /A B C 1-3 (a)."
128 sb="save outfile='b.sys'."
129 for types in ff ft; do
131 if [ $types = ff ]; then
136 for sources in ss sa as; do
137 name="$types-$sources"
138 activity="create $name.pspp"
140 if [ $sources = ss ]; then
146 match files $type1='a.sys' /in=INA /sort
147 /$type2='b.sys' /in=INB /rename c=D
148 /by a /first=FIRST /last=LAST.
150 elif [ $sources = sa ]; then
155 match files $type1='a.sys' /in=INA /sort
156 /$type2=* /in=INB /rename c=D
157 /by a /first=FIRST /last=LAST.
159 elif [ $sources = as ]; then
164 match files $type1=* /in=INA /sort
165 /$type2='b.sys' /in=INB /rename c=D
166 /by a /first=FIRST /last=LAST.
169 activity="internal error"
174 if [ $? -ne 0 ] ; then no_result ; fi
176 activity="run $name.pspp"
177 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
178 if [ $? -ne 0 ] ; then no_result ; fi
180 activity="check $name output"
181 perl -pi -e 's/^\s*$//g' pspp.list
182 perl -pi -e 's/^\s*$//g' $types.out
183 diff -b -w pspp.list $types.out
184 if [ $? -ne 0 ] ; then fail ; fi
188 # Test parallel match.
190 activity="create $name.pspp"
191 cat > $name.pspp <<EOF
196 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
199 if [ $? -ne 0 ] ; then no_result ; fi
201 activity="run $name.pspp"
202 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
203 if [ $? -ne 0 ] ; then no_result ; fi
205 activity="check $name output"
206 perl -pi -e 's/^\s*$//g' pspp.list
207 diff -b -w - pspp.list <<EOF
224 if [ $? -ne 0 ] ; then fail ; fi
226 # Test bug handling TABLE from active file found by John Darrington.
228 activity="create $name.pspp"
229 cat > $name.pspp <<EOF
230 DATA LIST LIST NOTABLE /x * y *.
237 SAVE OUTFILE='bar.sav'.
239 DATA LIST LIST NOTABLE /x * z *.
245 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
248 if [ $? -ne 0 ] ; then no_result ; fi
250 activity="run $name.pspp"
251 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
252 if [ $? -ne 0 ] ; then no_result ; fi
254 activity="check $name output"
255 perl -pi -e 's/^\s*$//g' pspp.list
256 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
258 -------- -------- --------
263 if [ $? -ne 0 ] ; then fail ; fi