X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fcommand%2Fupdate.sh;fp=tests%2Fcommand%2Fupdate.sh;h=8bcb56715d5c8980d7f83bdc2a9450c4621f4f17;hb=51755f0fbf79c3e5c756b5b835b0ce15267e02d3;hp=0000000000000000000000000000000000000000;hpb=ed09f0f21add5e56e8395a5e8589cda6f96420bf;p=pspp-builds.git diff --git a/tests/command/update.sh b/tests/command/update.sh new file mode 100755 index 00000000..8bcb5671 --- /dev/null +++ b/tests/command/update.sh @@ -0,0 +1,172 @@ +#!/bin/sh + +# This program tests the UPDATE procedure + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/update.pspp + + +# ensure that top_builddir are absolute +if [ -z "$top_builddir" ] ; then top_builddir=. ; fi +if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi +top_builddir=`cd $top_builddir; pwd` +PSPP=$top_builddir/src/ui/terminal/pspp + +# ensure that top_srcdir is absolute +top_srcdir=`cd $top_srcdir; pwd` + + +STAT_CONFIG_PATH=$top_srcdir/config +export STAT_CONFIG_PATH + +cleanup() +{ + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi + cd / + rm -rf $TEMPDIR +} + + +fail() +{ + echo $activity + echo FAILED + cleanup; + exit 1; +} + + +no_result() +{ + echo $activity + echo NO RESULT; + cleanup; + exit 2; +} + +pass() +{ + cleanup; + exit 0; +} + +mkdir -p $TEMPDIR + +cd $TEMPDIR + +activity="data create" +cat > a.data < b.data < update.out < $name.pspp + if [ $? -ne 0 ] ; then no_result ; fi + + activity="run $name.pspp" + rm -f errors + $SUPERVISOR $PSPP --testing-mode --error-file=errors $name.pspp + if [ $? -ne 0 ] ; then no_result ; fi + + activity="check $name output" + perl -pi -e 's/^\s*$//g' pspp.list + diff -c -b -w pspp.list update.out + if [ $? -ne 0 ] ; then fail ; fi + diff -c -b -w - errors <