Files
mercury/tests/recompilation/Mmakefile
Zoltan Somogyi 1f45f91886 Make "mmake runtests" work again.
My commit afe2887882 broke 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 after afe2887 runs 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 = .."
2020-06-10 01:05:15 +10:00

107 lines
2.6 KiB
Makefile

#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#
TESTS_DIR = ..
THIS_DIR = recompilation
MAYBE_J1 = -j1
TESTS_SHOULD_SUCCEED = \
add_constructor_nr \
add_constructor_r \
add_instance_r \
add_instance_2_r \
add_type_nr \
change_class_r \
change_func_r \
change_instance_r \
change_mode_r \
change_type_nr \
combined_type_mode_nr \
field_r \
func_overloading_nr \
func_overloading_r \
lambda_mode_r \
no_version_numbers_r \
pragma_type_spec_r \
pred_ctor_ambiguity_r \
pred_overloading_r \
typeclass_method_pragma_r \
type_spec_rename_var_r \
type_spec_unname_var_r \
unchanged_pred_nr \
unchanged_with_type_nr
# Parallel mmake with nested sub-modules is broken.
# The commands to create `.c' files from the `.m' file containing the
# nested sub-module are run twice, resulting in incorrect output in
# the `.err' file.
NO_PARALLEL_MAKE_TESTS = \
nested_module_r \
nested_module_2_r
TESTS_SHOULD_FAIL = \
add_type_re \
remove_type_re \
type_qual_re \
with_type_re
PROGS = $(TESTS_SHOULD_SUCCEED) $(NO_PARALLEL_MAKE_TESTS) \
$(TESTS_SHOULD_FAIL)
TESTS = $(sort $(PROGS:%=%-nodepend))
include ../Mmake.common
# Module-specific options should go in Mercury.options so they
# can be found by `mmc --make'.
include Mercury.options
$(TESTS_SHOULD_SUCCEED:%=%.runtest): %.runtest:
+@if ./two_module_test false $* $*_2; then \
:; \
else \
cat $*.res; \
exit 1; \
fi
$(NO_PARALLEL_MAKE_TESTS:%=%.runtest): %.runtest:
+@if mmakeopts=-j1 ./two_module_test false $* $*_2; then \
:; \
else \
cat $*.res; \
exit 1; \
fi
$(TESTS_SHOULD_FAIL:%=%.runtest): %.runtest:
+@if ./two_module_test true $* $*_2; then \
rm $*.failing_make_output; \
else \
cat $*.res; \
exit 1; \
fi
#-----------------------------------------------------------------------------#
realclean_local: realclean_recompilation
realclean_recompilation:
for module in $(PROGS) x; do \
rm -f $$module.m $${module}_2.m ;\
done
should_run_recompilation_tests:
@echo $(RUN_RECOMPILATION_TESTS)
# Smart recompilation doesn't yet work with --intermodule-optimization.
# The `override' is needed because otherwise make ignores the assignment if
# EXTRA_MCFLAGS is set on the command line, as it is for the nightly tests.
override EXTRA_MCFLAGS += \
--no-intermodule-optimization \
--smart-recompilation \
--find-all-recompilation-reasons
$(dates_subdir)nested_module_2_r_2.date: \
$(int0s_subdir)nested_module_2_r_2.int0
#-----------------------------------------------------------------------------#