mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
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.
46 lines
1.0 KiB
Bash
Executable File
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
|