mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Estimated hours taken: 9 Provide a more uniform interface to the test directories. Before this change, the tests directory as well as direct descendents had `runtests' scripts to execute the tests. These would run `mmake', which in turn would recursively run `mmake' in any subdirectories. The subdirectories did not have their own `runtests' scripts. This change adds a `runtests' script to those subdirectories that did not have them before. The scripts have the same meaning as they did previously---run all tests in the current directory and below, and return a status of 0 only if all tests pass. The rationale for this change is so that each directory in the tests is treated the same, regardless of whether it is a top-level directory or not. This means, for example, that any test directory can be used as an argument to the `--test-dir' option to tools/bootcheck. This change also links tests/general/accumulator into the automated testing suite. tests/README: Update comments. tests/Mmake.common: Introduce new target dependencies. Targets of the form `foo' depend on the targets `foo_local' and `foo_subdirs'. tests/subdir_runtests: New script to recursively call runtests scripts in subdirectories. Most of the code for this script originally came from tests/runtests. tests/shutdown: tests/startup: Use `realclean_local' as a target instead of `realclean', since the subdirectories will be handled by other runtests scripts. tests/runtests: tests/debugger/runtests: tests/general/runtests: tests/hard_coded/runtests: Use the new script to run tests in the subdirectories, rather than doing a recursive mmake. Make sure that non-zero return values are propagated upwards where appropriate. tests/debugger/declarative/runtests: tests/hard_coded/typeclasses/runtests: tests/hard_coded/sub-modules/runtests: New scripts to handle running tests in the subdirectories. tests/debugger/Mmakefile: tests/general/Mmakefile: tests/hard_coded/Mmakefile: Add `*_subdirs' targets that do a recursive Mmake. Change the existing targets to `*_local' ones. tests/warnings/Mmakefile: Manually add the extra dependencies, since this Mmakefile does not include tests/Mmake.common.
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 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
|
|
|
|
mmake $jfactor depend_local || exit 1
|
|
eval mmake -k $jfactor $gradeopt $flagsopt $cflagsopt check_local
|
|
checkstatus=$?
|
|
|
|
cat *.res > .allres
|
|
if test ! -s .allres -a "$checkstatus" = 0
|
|
then
|
|
echo "the tests in the hard_coded directory succeeded"
|
|
echo "gradeopt=$gradeopt, flagsopt=$flagsopt, cflagsopt=$cflagsopt"
|
|
rm -f .allres
|
|
. ../shutdown
|
|
exit $subdir_status
|
|
else
|
|
echo "the tests in the hard_coded directory failed"
|
|
echo "gradeopt=$gradeopt, flagsopt=$flagsopt, cflagsopt=$cflagsopt"
|
|
echo "the differences are:"
|
|
cat .allres
|
|
exit 1
|
|
fi
|