mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 05:43:53 +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.
178 lines
5.5 KiB
Plaintext
178 lines
5.5 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
|
|
main_target: check
|
|
|
|
include ../Mmake.common
|
|
|
|
RM_C=:
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# We suppress the printing of the banner, because different workspaces
|
|
# may get different version numbers printed in it. This would otherwise be
|
|
# the source of irrelevant difference between the actual and expected outputs.
|
|
|
|
MDB = MERCURY_SUPPRESS_MDB_BANNER=yes mdb
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
DEBUGGER_PROGS= \
|
|
browser_test \
|
|
debugger_regs \
|
|
existential_type_classes \
|
|
implied_instance \
|
|
interpreter \
|
|
mdb_command_test \
|
|
multi_parameter \
|
|
queens
|
|
|
|
# The following tests are disabled, since currently they get some spurious
|
|
# failures if readline support is enabled:
|
|
# interactive
|
|
|
|
MCFLAGS = --trace deep
|
|
MLFLAGS = --trace
|
|
C2INITFLAGS = --trace
|
|
|
|
# We need to use shared libraries for interactive queries to work.
|
|
# The following is necessary for shared libraries to work on Linux.
|
|
MGNUCFLAGS-interactive = --pic-reg
|
|
MLFLAGS-interactive = --shared
|
|
|
|
# Base grades `jump' and `fast' cannot be used with
|
|
# stack layouts (which are required for tracing).
|
|
|
|
ifneq "$(findstring asm_,$(GRADE))" ""
|
|
PROGS=$(DEBUGGER_PROGS)
|
|
else
|
|
ifneq "$(findstring jump,$(GRADE))" ""
|
|
PROGS=
|
|
else
|
|
ifneq "$(findstring fast,$(GRADE))" ""
|
|
PROGS=
|
|
else
|
|
PROGS=$(DEBUGGER_PROGS)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
browser_test.out: browser_test browser_test.inp
|
|
$(MDB) ./browser_test < browser_test.inp > browser_test.out 2>&1
|
|
|
|
debugger_regs.out: debugger_regs debugger_regs.inp
|
|
$(MDB) ./debugger_regs < debugger_regs.inp > debugger_regs.out 2>&1
|
|
|
|
existential_type_classes.out: existential_type_classes \
|
|
existential_type_classes.inp
|
|
$(MDB) ./existential_type_classes < existential_type_classes.inp \
|
|
> existential_type_classes.out 2>&1
|
|
|
|
implied_instance.out: implied_instance implied_instance.inp
|
|
$(MDB) ./implied_instance < implied_instance.inp \
|
|
> implied_instance.out 2>&1
|
|
|
|
interpreter.out: interpreter interpreter.inp
|
|
$(MDB) ./interpreter interpreter.m < interpreter.inp \
|
|
> interpreter.out 2>&1
|
|
|
|
multi_parameter.out: multi_parameter multi_parameter.inp
|
|
$(MDB) ./multi_parameter < multi_parameter.inp \
|
|
> multi_parameter.out 2>&1
|
|
|
|
queens.out: queens queens.inp
|
|
$(MDB) ./queens < queens.inp > queens.out 2>&1
|
|
|
|
# Note that interactive.out.orig depends on $(interactive.ints) because
|
|
# interactive.inp contains interactive queries that require interactive.ints
|
|
# to have been built.
|
|
interactive.out.orig: interactive interactive.inp $(interactive.ints)
|
|
$(MDB) ./interactive < interactive.inp > interactive.out.orig 2>&1
|
|
|
|
# We pipe the output through sed to remove some spurious warnings that
|
|
# `ld' issues.
|
|
# XXX we should fix the spurious warnings about unresolved symbols.
|
|
# (The spurious warnings about exception handling are due to a flaw
|
|
# in the Digital Unix 3.2 linker, so that one is DEC's problem.)
|
|
interactive.out: interactive.out.orig
|
|
cat interactive.out.orig | \
|
|
sed \
|
|
-e '/\/usr\/bin\/ld:$$/N' \
|
|
-e 's/\/usr\/bin\/ld:.//' \
|
|
-e '/Warning: Linking some objects which contain exception information sections$$/N' \
|
|
-e 's/Warning: Linking some objects which contain exception information sections.//' \
|
|
-e '/ and some which do not. This may cause fatal runtime exception handling$$/N' \
|
|
-e 's/ and some which do not. This may cause fatal runtime exception handling.//' \
|
|
-e '/ problems (last obj encountered without exceptions was .*)\.$$/N' \
|
|
-e 's/ problems (last obj encountered without exceptions was .*)\..//' \
|
|
-e '/Warning: Unresolved:$$/N' \
|
|
-e 's/Warning: Unresolved:.//' \
|
|
-e '/<predicate .main.\/2 mode 0>$$/N' \
|
|
-e 's/<predicate .main.\/2 mode 0>.//' \
|
|
-e '/<predicate .interactive:qperm.\/2 mode 0>$$/N' \
|
|
-e 's/<predicate .interactive:qperm.\/2 mode 0>.//' \
|
|
-e '/__start$$/N' \
|
|
-e 's/__start.//' \
|
|
> queens.out
|
|
# ignore egcs internal errors -- those are not our fault
|
|
if grep 'gcc.*Internal compiler error' queens.out; then \
|
|
cp queens.exp queens.out; \
|
|
fi
|
|
|
|
# We ignore the result of this action because
|
|
# the exit status of grep is not useful in this case
|
|
mdb_command_test.out: mdb_command_test mdb_command_test.inp
|
|
-$(MDB) ./mdb_command_test < mdb_command_test.inp 2>&1 \
|
|
| egrep "internal error in the trace help system" \
|
|
> mdb_command_test.out
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
DEPS= $(PROGS:%=$(deps_subdir)%.dep)
|
|
DEPENDS= $(PROGS:%=%.depend)
|
|
OUTS= $(PROGS:%=%.out)
|
|
RESS= $(PROGS:%=%.res)
|
|
|
|
dep_local: $(DEPS)
|
|
depend_local: $(DEPENDS)
|
|
check_local: $(OUTS) $(RESS)
|
|
all_local: $(PROGS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
SUBDIRS = declarative
|
|
|
|
check_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
|
|
done
|
|
|
|
dep_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
|
|
done
|
|
|
|
depend_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
|
|
done
|
|
|
|
realclean_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
|
|
done
|
|
|
|
clean_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
|
|
done
|
|
|
|
all_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
|
|
done
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|