mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
tests/recompilation/Mmakefile:
Disable recompilation tests for Java and C#. Document the reason.
Add a pointer to the new code in make.top_level.m that may help
to fix the underlying problem.
compiler/make.top_level.m:
Add module.target as a synonym for whichever of module.c, module.java
or module.cs is appropriate for the current grade.
Add mainmodule.targets and mainmodule.all_targets as similar synonyms
for all the target language files of a program.
The intention is that the recompilation tests should specify
testcase.all_targets, not the test case's executable,
as the target to be made.
136 lines
3.7 KiB
Makefile
136 lines
3.7 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)
|
|
|
|
# Disable all the tests in this directory in C# and Java grades.
|
|
# The reason for this is that
|
|
#
|
|
# - these grades *have* to use mmc --make;
|
|
#
|
|
# - mmc --make builds object files and executables by invoking the target
|
|
# language compiler and the linker from mmc, while mmake builds them
|
|
# by invoking the target language compiler and the linker from make actions;
|
|
#
|
|
# - this means that with mmc --make, the op_mode of compiler invocations
|
|
# that build executables is opfam_target_object_and_executable;
|
|
#
|
|
# - maybe_disable_smart_recompilation in handle_options.m explicitly disables
|
|
# smart recompilation for such op_modes; and
|
|
#
|
|
# - testing smart recompilation after it has been disabled is futile.
|
|
#
|
|
# The root cause seems to be that although smart recompilation was intended
|
|
# to be used with mmc --make, its test infrastructure uses mmake, and was
|
|
# never updated to use mmc --make directly.
|
|
#
|
|
# In that update, the use of modulename.targets, instead of e.g.
|
|
# modulename.javas, could help.
|
|
|
|
ifeq "$(filter csharp% java%,$(GRADE))" ""
|
|
TESTS = $(sort $(PROGS:%=%-nodepend))
|
|
else
|
|
TESTS =
|
|
endif
|
|
include ../Mmake.common
|
|
|
|
# Module-specific options should go in Mercury.options so they
|
|
# can be found by `mmc --make'.
|
|
include Mercury.options
|
|
|
|
MCFLAGS += --color-diagnostics
|
|
|
|
$(TESTS_SHOULD_SUCCEED:%=%.runtest): %.runtest:
|
|
+@if ./two_module_test should_succeed $* $*_2; then \
|
|
:; \
|
|
else \
|
|
cat $*.res; \
|
|
exit 1; \
|
|
fi
|
|
|
|
$(NO_PARALLEL_MAKE_TESTS:%=%.runtest): %.runtest:
|
|
+@if mmakeopts=-j1 ./two_module_test should_succeed $* $*_2; then \
|
|
:; \
|
|
else \
|
|
cat $*.res; \
|
|
exit 1; \
|
|
fi
|
|
|
|
$(TESTS_SHOULD_FAIL:%=%.runtest): %.runtest:
|
|
+@if ./two_module_test should_fail $* $*_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
|
|
|
|
# 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
|
|
|
|
#-----------------------------------------------------------------------------#
|