Files
mercury/samples/tests/diff/runtests
Mark Brown 61727c021e Specify the full pathname when source'ing Mmake.thisdir, since
Estimated hours taken: 0.5

samples/tests/*/runtests:
	Specify the full pathname when source'ing Mmake.thisdir, since
	the current directory is not always searched.
2001-02-09 06:46:42 +00:00

48 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# Test whether the code generated by the Mercury compiler
# is producing the expected output.
# Return a status of 0 (true) if everything is all right, and 1 otherwise.
. ./Mmake.thisdir
. $DEPTH/handle_options
# Run the tests in any subdirectories of this one. If any of these
# fail, we still perform the tests in this directory but return a
# status of 1 regardless of the outcome.
. $DEPTH/subdir_runtests
if test "$subdir_failures" = ""
then
subdir_status=0
else
subdir_status=1
fi
# Now run all the tests in this directory.
. $DEPTH/startup
eval mmake $mmakeopts depend_local || exit 1
eval mmake -k $mmakeopts check_local
checkstatus=$?
pwdir=`pwd`
thisdirname=`basename $pwdir`
cat *.res > .allres
if test ! -s .allres -a "$checkstatus" = 0
then
echo "the tests in the $thisdirname directory succeeded"
echo "mmakeopts=$mmakeopts"
rm -f .allres
. $DEPTH/shutdown
exit $subdir_status
else
echo "the tests in the $thisdirname directory failed"
echo "mmakeopts=$mmakeopts"
echo "the differences are:"
cat .allres
exit 1
fi