Files
mercury/samples/tests/rot13/runtests
Tyson Dowd d64781a3d7 Add a testing architecture for the samples directory.
Estimated hours taken: 15

Add a testing architecture for the samples directory.
The tests are in the "tests" subdirectory of the samples
directory.  This keeps them close to the samples, but not close
enough to clutter up the samples.
It also means you don't have to worry about the issue of exactly where
the developer has checked out the CVS tests module.

samples/c_interface/simpler_c_calls_mercury/Mmakefile:
	Update this example to generate a .a file
	instead of directly using $(mercury_lib.os)

samples/tests/*:
	Test cases for all the samples.
2000-02-14 05:28:45 +00:00

46 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.
. ../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.
. ../subdir_runtests
if test "$subdir_failures" = ""
then
subdir_status=0
else
subdir_status=1
fi
# Now run all the tests in this directory.
. ../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
. ../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