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.out <<EOF
105 perl -pi -e 's/^\s*$//g' update.out
108 dla="data list notable file='a.data' /A B C 1-3 (a)."
109 sa="save outfile='a.sys'."
110 dlb="data list notable file='b.data' /A B C 1-3 (a)."
111 sb="save outfile='b.sys'."
112 for sources in ss sa as; do
114 activity="create $name.pspp"
116 if [ $sources = ss ]; then
123 update file='a.sys' /in=INA /sort
124 /file='b.sys' /in=INB /rename c=D
127 elif [ $sources = sa ]; then
134 update file='a.sys' /in=INA /sort
135 /file=* /in=INB /rename c=D
138 elif [ $sources = as ]; then
145 update file=* /in=INA /sort
146 /file='b.sys' /in=INB /rename c=D
150 activity="internal error"
155 if [ $? -ne 0 ] ; then no_result ; fi
157 activity="run $name.pspp"
159 $SUPERVISOR $PSPP --testing-mode --error-file=errors $name.pspp
160 if [ $? -ne 0 ] ; then no_result ; fi
162 activity="check $name output"
163 perl -pi -e 's/^\s*$//g' pspp.list
164 diff -c -b -w pspp.list update.out
165 if [ $? -ne 0 ] ; then fail ; fi
166 diff -c -b -w - errors <<EOF
167 $name.pspp:8: warning: UPDATE: Encountered 3 sets of duplicate cases in the master file.
169 if [ $? -ne 0 ] ; then fail ; fi