3 # This program tests the UPDATE procedure
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/update.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 > update.csv <<EOF
107 dla="data list notable file='a.data' /A B C 1-3 (a)."
108 sa="save outfile='a.sys'."
109 dlb="data list notable file='b.data' /A B C 1-3 (a)."
110 sb="save outfile='b.sys'."
111 for sources in ss sa as; do
113 activity="create $name.pspp"
115 if [ $sources = ss ]; then
122 update file='a.sys' /in=INA /sort
123 /file='b.sys' /in=INB /rename c=D
126 elif [ $sources = sa ]; then
133 update file='a.sys' /in=INA /sort
134 /file=* /in=INB /rename c=D
137 elif [ $sources = as ]; then
144 update file=* /in=INA /sort
145 /file='b.sys' /in=INB /rename c=D
149 activity="internal error"
154 if [ $? -ne 0 ] ; then no_result ; fi
156 activity="run $name.pspp"
158 $SUPERVISOR $PSPP -o pspp.csv --error-file=errors $name.pspp
159 if [ $? -ne 0 ] ; then no_result ; fi
161 activity="check $name output"
162 perl -pi -e 's/^\s*$//g' pspp.csv
163 diff -c pspp.csv update.csv
164 if [ $? -ne 0 ] ; then fail ; fi
165 diff -c -b -w - errors <<EOF
166 $name.pspp:8: warning: UPDATE: Encountered 3 sets of duplicate cases in the master file.
168 if [ $? -ne 0 ] ; then fail ; fi