3 # This program tests the ADD FILES procedure
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/add-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
87 cat > concatenate.csv <<EOF
111 cat > interleave.csv <<EOF
113 A,B,C,D,INA,INB,FIRST,LAST
136 dla="data list notable file='a.data' /A B C 1-3 (a)."
137 sa="save outfile='a.sys'."
138 dlb="data list notable file='b.data' /A B C 1-3 (a)."
139 sb="save outfile='b.sys'."
140 for type in interleave concatenate; do
141 if test $type = interleave; then
142 by="/by a /first=FIRST /last=LAST"
148 for sources in ss sa as; do
149 name="$type-$sources"
150 activity="create $name.pspp"
152 if [ $sources = ss ]; then
158 add files file='a.sys' /in=INA $sort
159 /file='b.sys' /in=INB /rename c=D
162 elif [ $sources = sa ]; then
167 add files file='a.sys' /in=INA $sort
168 /file=* /in=INB /rename c=D
171 elif [ $sources = as ]; then
176 add files file=* /in=INA $sort
177 /file='b.sys' /in=INB /rename c=D
181 activity="internal error"
186 if [ $? -ne 0 ] ; then no_result ; fi
188 activity="run $name.pspp"
189 $SUPERVISOR $PSPP -o pspp.csv $name.pspp
190 if [ $? -ne 0 ] ; then no_result ; fi
192 activity="check $name output"
193 perl -pi -e 's/^\s*$//g' pspp.csv
194 perl -pi -e 's/^\s*$//g' $type.csv
195 diff -u -b -w pspp.csv $type.csv
196 if [ $? -ne 0 ] ; then fail ; fi