mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 11:23:46 +00:00
My commitafe2887882broke the ability to run the test suite outside of a bootcheck by executing "mmake runtests" in the tests directory. This diff fixes that. tests/Mmake.common: Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile defined it as such, I overlooked the fact that tests/Mmakefile itself defined it ".", referring to the same directory from a different starting point. Document this easily-overlooked fact. Rename the old runtests target, which afterafe2887runs the tests in a single directory, as runtests_dir, to leave the target name "runtests" itself free for tests/Mmakefile to use. tests/Mmakefile: Define "TESTS_DIR = .", and add a target "runtests" which invokes "mmake runtests_dir" in each test directory. tools/bootcheck: Invoke "mmake runtests_dir" instead of "mmake runtests" in each test directory. Initialize a variable just before it is used. tests/*/Mmakefile: Add back the definition "TESTS_DIR = .."
92 lines
2.8 KiB
Makefile
92 lines
2.8 KiB
Makefile
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab ft=make
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
TESTS_DIR = ..
|
|
THIS_DIR = invalid_submodule
|
|
MAYBE_J1 = -j1
|
|
|
|
# This directory contains tests for errors in programs in which at least
|
|
# one source file contains more than one nested module. We disable
|
|
# parallel make with the -j1 above, because if we didn't, we would get
|
|
# intermittent failures caused by interface files of nested submodules
|
|
# not being ready when another job, executed in parallel by mmake,
|
|
# wants to read them.
|
|
#
|
|
# For multi-module tests (which includes all the tests in this directory)
|
|
# we normally need to make the dependencies. However, multi-module tests
|
|
# where the error is detected when building the dependencies
|
|
# (e.g. duplicate_module_test.m) should be included in DO_NOT_MAKE_DEP_PROGS,
|
|
# not MAKE_DEP_PROGS, because we have a specific make rule for them below.
|
|
|
|
MAKE_DEP_PROGS = \
|
|
exported_unify3 \
|
|
import_in_parent \
|
|
missing_parent_import \
|
|
sub_c \
|
|
undef_mod_qual \
|
|
unresolved_overloading
|
|
|
|
DO_NOT_MAKE_DEP_PROGS = \
|
|
duplicate_module_test \
|
|
func_class \
|
|
nested_impl_in_int
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
PROGS = $(MAKE_DEP_PROGS) $(DO_NOT_MAKE_DEP_PROGS)
|
|
TESTS = $(sort $(MAKE_DEP_PROGS) $(DO_NOT_MAKE_DEP_PROGS:%=%-nodepend))
|
|
include ../Mmake.common
|
|
|
|
# Module-specific options should go in Mercury.options so they can be found
|
|
# by `mmc --make'.
|
|
include Mercury.options
|
|
|
|
%.runtest: %.err_res ;
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
ifneq ($(MMAKE_USE_MMC_MAKE),yes)
|
|
|
|
%.err: %.m
|
|
if $(MC) --errorcheck-only $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) $* \
|
|
> $*.err 2>&1; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
else
|
|
|
|
% XXX: with `mmake --use-mmc-make' the ".DEFAULT:" rule seems to take
|
|
# precedence over "%.err: %.m" rules.
|
|
% XXX: the reason we run the $(MCM) command twice is to avoid doubled up
|
|
# error messages, once while making interface files, then the module proper.
|
|
# The second time the command is run, only one set of error messages
|
|
# should appear.
|
|
$(addsuffix .err,$(PROGS)):
|
|
-$(MCM) $@
|
|
if $(MCM) -r $@ > /dev/null 2>&1 ; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
endif
|
|
|
|
# For these test cases, the bug is caught when generating dependencies,
|
|
# so it is easiest just to do that step.
|
|
$(addsuffix .err,$(DO_NOT_MAKE_DEP_PROGS)): %.err: %.m
|
|
if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) \
|
|
--generate-dependencies $* > $*.err 2>&1; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
$(dates_subdir)undef_mod_qual.date: $(int0s_subdir)undef_mod_qual.int0
|
|
|
|
clean_local: clean_invalid_submodules
|
|
|
|
clean_invalid_submodules:
|
|
rm -f *dep_err *.err *.err_res
|
|
|
|
#-----------------------------------------------------------------------------#
|