[m-rev.] for review: Avoid tests/invalid failures with intermodule optimisation.

Peter Wang novalazy at gmail.com
Mon Nov 9 17:15:03 AEDT 2020


tests/invalid/Mmakefile:
    For modules for which the compiler may emit errors while making
    their .opt files, redirect the errors to a .err file and ignore the
    exit status. The .err file will then be compared to .err_exp* files.

diff --git a/tests/invalid/Mmakefile b/tests/invalid/Mmakefile
index 976bc876d..209f42290 100644
--- a/tests/invalid/Mmakefile
+++ b/tests/invalid/Mmakefile
@@ -562,6 +562,30 @@ require_tailrec_1.err require_tailrec_2.err require_tailrec_3.err foreign_includ
 	else true; \
 	fi
 
+# For the following modules, error messages may be be produced while making a
+# `.opt' file. Add specific rules to capture those errors into a `.err' file,
+# and ignore the exit status.
+ifeq "$(filter --intermod%,$(EXTRA_MCFLAGS))" ""
+REDIRECT_OPT_ERROR_MODULES =
+else
+REDIRECT_OPT_ERROR_MODULES = \
+	abstract_eqv \
+	bad_type_class_constraint_intermodule \
+	bad_type_class_constraint_intermodule_2 \
+	bug214 \
+	bug521 \
+	bug521_sub \
+	int_impl_imports \
+	test_feature_set
+endif
+
+define OVERRIDE_OPT_RULE
+$$(optdates_subdir)$(1).optdate $(1).err : $(1).m
+	$$(MCOI) $$(ALL_GRADEFLAGS) $$(ALL_MCOIFLAGS) $$(*F) $$(ERR_REDIRECT) || true
+endef
+
+$(foreach module,$(REDIRECT_OPT_ERROR_MODULES),$(eval $(call OVERRIDE_OPT_RULE,$(module))))
+
 clean_local: clean_invalid
 
 clean_invalid:
-- 
2.28.0



More information about the reviews mailing list