X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=tests%2Fcommand%2Floop.sh;h=71173753598d9b5bc60c76c9f34a54609ae3301e;hb=173d1687aea88e0e5e1b1d8615ed68ebefb15d08;hp=7c7e493aa3767ece748ac3e16bd1c978c4cb1583;hpb=655bf3a3917cdf16f99fcbb680d2bf3159126a93;p=pspp diff --git a/tests/command/loop.sh b/tests/command/loop.sh index 7c7e493aa3..7117375359 100755 --- a/tests/command/loop.sh +++ b/tests/command/loop.sh @@ -9,7 +9,7 @@ TESTFILE=$TEMPDIR/`basename $0`.sps 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 +PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT # ensure that top_srcdir is absolute top_srcdir=`cd $top_srcdir; pwd` @@ -23,6 +23,10 @@ export LANG cleanup() { + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi cd / rm -rf $TEMPDIR } @@ -57,23 +61,77 @@ cd $TEMPDIR activity="create prog" cat > $TEMPDIR/loop.stat < y. +print/'--------'. +execute. + +echo 'Loop with index and IF condition based on index'. +loop #m=x to y by z if #m < 4. +print /#m. end loop. +print/'--------'. +execute. + +echo 'Loop with index and END IF condition based on index'. +loop #n=x to y by z. +print /#n. +end loop if #n >= 4. +print/'--------'. +execute. + +echo 'Loop with index and IF and END IF condition based on index'. +loop #o=x to y by z if mod(#o,2) = 0. +print /#o. +end loop if #o >= 4. +print/'--------'. +execute. + +echo 'Loop with no conditions'. +set mxloops = 2. +compute #p = x. +loop. +print /#p. +compute #p = #p + z. +do if #p >= y. +break. +end if. +end loop. +print/'--------'. execute. EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TEMPDIR/loop.stat > $TEMPDIR/stdout +$SUPERVISOR $PSPP -o pspp.csv -e $TEMPDIR/stdout $TEMPDIR/loop.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare stdout" @@ -83,20 +141,156 @@ EOF if [ $? -ne 0 ] ; then fail ; fi activity="compare results" -perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list -diff -b $TEMPDIR/pspp.list - <