From de1e7ce86d2fb9d050d42256605f39364cb30714 Mon Sep 17 00:00:00 2001 From: Zoltan Somogyi Date: Sat, 14 Mar 2026 12:14:47 +1100 Subject: [PATCH] Factor out many rules into one implicit rule. Delete parts of an action that are needed only on machines running OSF-1. Delete parts of an action that have been obsolete since we switched to '.' as the module qualifier character decades ago. --- tests/debugger/Mmakefile | 218 +++++++-------------------------------- 1 file changed, 40 insertions(+), 178 deletions(-) diff --git a/tests/debugger/Mmakefile b/tests/debugger/Mmakefile index bbb22eab1..df7aa52e1 100644 --- a/tests/debugger/Mmakefile +++ b/tests/debugger/Mmakefile @@ -1,12 +1,12 @@ -#-----------------------------------------------------------------------------# +#---------------------------------------------------------------------------# # vim: ts=8 sw=8 noexpandtab ft=make -#-----------------------------------------------------------------------------# +#---------------------------------------------------------------------------# TESTS_DIR = .. THIS_DIR = debugger MAYBE_J1 = -#-----------------------------------------------------------------------------# +#---------------------------------------------------------------------------# RETRY_PROGS = \ all_solutions \ @@ -251,7 +251,6 @@ else endif TESTS = $(sort $(PROGS)) -include ../Mmake.common # The minimum trace level in .decldebug grades is --trace decl. ifneq "$(findstring decldebug,$(GRADE))" "" @@ -276,32 +275,45 @@ include Mercury.options %.runtest: %.res ; -#-----------------------------------------------------------------------------# +#---------------------------------------------------------------------------# -ambiguity.out: ambiguity ambiguity.inp - $(MDB_STD) ./ambiguity < ambiguity.inp > ambiguity.out 2>&1 +# We pipe the output through sed to avoid hard-coding dependencies on +# - particular line numbers in the standard library source code, or +# - particular addresses on the heap. +# These four patterns cover the needs of most of our test cases +# (though no test case needs them all, and some test cases need none). +SED_1 = -e 's/io.m:[0-9]*/io.m:NNNN/g' +SED_2 = -e 's/char.m:[0-9]*/char.m:NNNN/g' +# The extra spaces are there because we do not want to modify +# references to line numbers in mmos_print.m. +SED_3 = -e 's/ int.m:[0-9]*/ int.m:NNNN/g' +SED_4 = -e 's/c_pointer(0x[-0-9A-Fa-f]*)/c_pointer(0xXXXX)/g' +SED_ALL = $(SED_1) $(SED_2) $(SED_3) $(SED_4) + +# NOTE This rule *must* precede the inclusion of ../Mmake.common, because +# +# - Mmake.common also defines an implicit rule to generate %.out from +# % (and maybe %.inp), but with an action that does not involve mdb, and +# +# - in cases where two implicit rules both apply, make will use +# the textually earlier one. +%.out: % %.inp + $(MDB_STD) ./$* < $*.inp 2>&1 | sed $(SED_ALL) > $*.out 2>&1 + +include ../Mmake.common + +#---------------------# all_solutions.out: all_solutions all_solutions.inp $(MDB) ./all_solutions < all_solutions.inp > all_solutions.out 2>&1 -breakpoints.out: breakpoints breakpoints.inp - $(MDB_STD) ./breakpoints < breakpoints.inp > breakpoints.out 2>&1 - browse_packed.out: browse_packed browse_packed.inp $(MDB) ./browse_packed < browse_packed.inp > browse_packed.out 2>&1 -# We need to pipe the output through sed to avoid hard-coding dependencies on -# particular line numbers in the standard library source code. browse_pretty.out: browse_pretty browse_pretty.inp $(MDB) ./browse_pretty < browse_pretty.inp 2>&1 | \ sed 's/io.m:[0-9]*/io.m:NNNN/g' > browse_pretty.out 2>&1 -# We need to pipe the output through sed to avoid hard-coding dependencies on -# particular line numbers in the standard library source code. -browser_test.out: browser_test browser_test.inp - $(MDB_STD) ./browser_test < browser_test.inp 2>&1 | \ - sed 's/io.m:[0-9]*/io.m:NNNN/g' > browser_test.out 2>&1 - # We need to pipe the output through sed to avoid hard-coding dependencies on # particular line numbers in the standard library source code. class_decl.out: class_decl class_decl.inp @@ -314,13 +326,6 @@ cmd_quote.out: cmd_quote cmd_quote.inp $(MDB) ./cmd_quote < cmd_quote.inp 2>&1 | \ sed 's/io.m:[0-9]*/io.m:NNNN/g' > cmd_quote.out 2>&1 -cond.out: cond cond.inp - $(MDB_STD) ./cond < cond.inp > cond.out 2>&1 - -chooser_tag_test.out: chooser_tag_test chooser_tag_test.inp - $(MDB_STD) ./chooser_tag_test < chooser_tag_test.inp \ - > chooser_tag_test.out 2>&1 - # Set up readline to make it easier to use completion non-interactively. completion.out: completion completion.inp INPUTRC=completion.inputrc $(MDB) ./completion \ @@ -329,25 +334,6 @@ completion.out: completion completion.inp debugger_regs.out: debugger_regs debugger_regs.inp $(MDB) ./debugger_regs < debugger_regs.inp > debugger_regs.out 2>&1 -deeply_nested_typeinfo.out: deeply_nested_typeinfo deeply_nested_typeinfo.inp - $(MDB_STD) ./deeply_nested_typeinfo < deeply_nested_typeinfo.inp \ - > deeply_nested_typeinfo.out 2>&1 - -direct_arg_test.out: direct_arg_test direct_arg_test.inp - $(MDB_STD) ./direct_arg_test < direct_arg_test.inp \ - > direct_arg_test.out 2>&1 - -double_print.out: double_print double_print.inp - $(MDB_STD) ./double_print < double_print.inp > double_print.out 2>&1 - -poly_io_retry_1.out: poly_io_retry_1 poly_io_retry_1.inp - $(MDB_STD) ./poly_io_retry_1 < poly_io_retry_1.inp \ - > poly_io_retry_1.out 2>&1 - -poly_io_retry_2.out: poly_io_retry_2 poly_io_retry_2.inp - $(MDB_STD) ./poly_io_retry_2 < poly_io_retry_2.inp \ - > poly_io_retry_2.out 2>&1 - # The exception_cmd, exception_vars and loopcheck tests # are supposed to return a non-zero exit status, since they exit by throwing # an exception. We strip the goal paths from their exception events, since @@ -429,10 +415,8 @@ existential_type_classes.out: existential_type_classes \ > existential_type_classes.out exported_eqv_type.out: exported_eqv_type exported_eqv_type.inp - $(MDB_STD) ./exported_eqv_type < exported_eqv_type.inp > exported_eqv_type.out 2>&1 - -fib.out: fib fib.inp - $(MDB_STD) ./fib < fib.inp > fib.out 2>&1 + $(MDB_STD) ./exported_eqv_type < exported_eqv_type.inp \ + > exported_eqv_type.out 2>&1 field_names.out: field_names field_names.inp $(MDB) ./field_names < field_names.inp > field_names.out 2>&1 @@ -443,27 +427,18 @@ foreign_type.out: foreign_type foreign_type.inp sed 's/coord, [0-9A-F][0-9A-F][0-9A-F]*/coord, 0xXXXX/g' \ > foreign_type.out 2>&1 -higher_order.out: higher_order higher_order.inp - $(MDB_STD) ./higher_order < higher_order.inp > higher_order.out 2>&1 - implied_instance.out: implied_instance implied_instance.inp $(MDB) ./implied_instance < implied_instance.inp \ > implied_instance.out 2>&1 -io_tab_goto.out: io_tab_goto io_tab_goto.inp - $(MDB_STD) ./io_tab_goto < io_tab_goto.inp 2>&1 | \ - sed 's/c_pointer(0x[-0-9A-Fa-f]*)/c_pointer(0xXXXX)/g' \ - > io_tab_goto.out 2>&1 - -lambda_expr.out: lambda_expr lambda_expr.inp - $(MDB_STD) ./lambda_expr < lambda_expr.inp > lambda_expr.out 2>&1 +# NOTE This program takes its own source code as input. +interpreter.out: interpreter interpreter.inp + $(MDB_STD) ./interpreter interpreter.m < interpreter.inp \ + > interpreter.out 2>&1 label_layout.out: label_layout label_layout.inp $(MDB) ./label_layout < label_layout.inp > label_layout.out 2>&1 -lambdatest.out: lambdatest lambdatest.inp - $(MDB_STD) ./lambdatest < lambdatest.inp > lambdatest.out 2>&1 - list_cmd.out: list_cmd list_cmd.inp $(MDB) ./list_cmd < list_cmd.inp > list_cmd.out 2>&1 @@ -490,10 +465,6 @@ interpreter.m: ../../samples/interpreter.m cp ../../samples/interpreter.m . chmod a-w interpreter.m -interpreter.out: interpreter interpreter.inp - $(MDB_STD) ./interpreter interpreter.m < interpreter.inp \ - > interpreter.out 2>&1 - lval_desc_array.out: lval_desc_array lval_desc_array.inp $(MDB) ./lval_desc_array < lval_desc_array.inp \ > lval_desc_array.out 2>&1 @@ -517,49 +488,17 @@ no_inline_builtins.out: no_inline_builtins no_inline_builtins.inp > no_inline_builtins.out 2>&1 mmos_print.out: mmos_print mmos_print.inp - $(MDB) ./mmos_print < mmos_print.inp \ - > mmos_print.out 2>&1 + $(MDB) ./mmos_print < mmos_print.inp > mmos_print.out 2>&1 mutrec.out: mutrec mutrec.inp $(MDB) ./mutrec < mutrec.inp > mutrec.out 2>&1 -mutrec_higher_order.out: mutrec_higher_order mutrec_higher_order.inp - $(MDB_STD) ./mutrec_higher_order < mutrec_higher_order.inp \ - > mutrec_higher_order.out 2>&1 - # We need to pipe the output through sed to avoid hard-coding dependencies on # particular line numbers in the standard library source code. output_term_dep.out: output_term_dep output_term_dep.inp $(MDB) ./output_term_dep < output_term_dep.inp 2>&1 | \ sed 's/io.m:[0-9]*/io.m:NNNN/g' > output_term_dep.out 2>&1 -pack.out: pack pack.inp - $(MDB_STD) ./pack < pack.inp > pack.out 2>&1 - -polymorphic_ground_term.out: polymorphic_ground_term polymorphic_ground_term.inp - $(MDB_STD) ./polymorphic_ground_term < polymorphic_ground_term.inp \ - > polymorphic_ground_term.out 2>&1; - -polymorphic_output.out: polymorphic_output polymorphic_output.inp - $(MDB_STD) ./polymorphic_output < polymorphic_output.inp \ - > polymorphic_output.out 2>&1; - -print_goal.out: print_goal print_goal.inp - $(MDB_STD) ./print_goal < print_goal.inp > print_goal.out 2>&1 - -print_io_actions.out: print_io_actions print_io_actions.inp \ - print_io_actions.data - $(MDB_STD) ./print_io_actions < print_io_actions.inp | \ - sed 's/c_pointer(0x[-0-9A-Fa-f]*)/c_pointer(0xXXXX)/g' \ - > print_io_actions.out 2>&1 - -print_table.out: print_table print_table.inp - $(MDB_STD) ./print_table < print_table.inp > print_table.out 2>&1 - -queens.out: queens queens.inp - $(MDB_STD) ./queens < queens.inp 2>&1 | \ - sed 's/int.m:[0-9]*/int.m:NNNN/g' > queens.out 2>&1 - queens_rep.out: queens_rep queens_rep.inp $(MDB) ./queens_rep < queens_rep.inp > queens_rep.out 2>&1 @@ -583,9 +522,6 @@ resume_typeinfos.out: resume_typeinfos resume_typeinfos.inp sed 's/resume_typeinfos.m:[0-9]*/resume_typeinfos.m:NNNN/g' \ > resume_typeinfos.out 2>&1 -retry.out: retry retry.inp - $(MDB_STD) ./retry < retry.inp > retry.out 2>&1 - # The value of web_browser_cmd will be system specific, so we pipe the output # through sed and replace the system specific bit with a known character # sequence. @@ -603,29 +539,8 @@ scripts.out: scripts scripts.inp shallow.out: shallow shallow.inp $(MDB) ./shallow < shallow.inp > shallow.out 2>&1 -shell.out: shell shell.inp - $(MDB_STD) ./shell < shell.inp > shell.out 2>&1 - -switch_on_unbounded.out: switch_on_unbounded switch_on_unbounded.inp - $(MDB_STD) ./switch_on_unbounded < switch_on_unbounded.inp \ - > switch_on_unbounded.out 2>&1 - -tabled_read.out: tabled_read tabled_read.inp tabled_read.data - $(MDB_STD) ./tabled_read < tabled_read.inp 2>&1 | \ - sed 's/c_pointer(0x[-0-9A-Fa-f]*)/c_pointer(0xXXXX)/g' \ - > tabled_read.out 2>&1 - tabled_read_unitize.out: tabled_read_unitize.data -tabled_read_unitize.out: tabled_read_unitize tabled_read_unitize.inp - $(MDB_STD) ./tabled_read_unitize < tabled_read_unitize.inp \ - > tabled_read_unitize.out 2>&1 - -tabled_read_decl.out: tabled_read_decl tabled_read_decl.inp tabled_read_decl.data - $(MDB_STD) ./tabled_read_decl < tabled_read_decl.inp 2>&1 | \ - sed 's/c_pointer(0x[-0-9A-Fa-f]*)/c_pointer(0xXXXX)/g' \ - > tabled_read_decl.out 2>&1 - tabled_typeclass.out: tabled_typeclass tabled_typeclass.inp $(MDB_STD) ./tabled_typeclass < tabled_typeclass.inp 2>&1 | \ sed 's/0x[-0-9A-Fa-f]*/0xXXXX/g' | \ @@ -634,48 +549,6 @@ tabled_typeclass.out: tabled_typeclass tabled_typeclass.inp sed 's/system_error, 0\{2\}0*/system_error, 0xXXXX/g' \ > tabled_typeclass.out 2>&1 -tailrec1.out: tailrec1 tailrec1.inp tailrec1.data - $(MDB_STD) ./tailrec1 < tailrec1.inp > tailrec1.out 2>&1 - -term_size_cells.out: term_size_cells term_size_cells.inp - $(MDB_STD) ./term_size_cells < term_size_cells.inp \ - > term_size_cells.out 2>&1 - -term_size_words.out: term_size_words term_size_words.inp - $(MDB_STD) ./term_size_words < term_size_words.inp \ - > term_size_words.out 2>&1 - -type_desc_test.out: type_desc_test type_desc_test.inp - $(MDB_STD) ./type_desc_test < type_desc_test.inp \ - > type_desc_test.out 2>&1 - -uci.out: uci uci.inp - $(MDB_STD) ./uci < uci.inp > uci.out 2>&1 - -uci_index.out: uci_index uci_index.inp - $(MDB_STD) ./uci_index < uci_index.inp > uci_index.out 2>&1 - -synth_attr.out: synth_attr synth_attr.inp synth_attr_spec - $(MDB_STD) ./synth_attr < synth_attr.inp > synth_attr.out 2>&1 - -synth_attr_impure.out: synth_attr_impure synth_attr_impure.inp \ - synth_attr_impure_spec - $(MDB_STD) ./synth_attr_impure < synth_attr_impure.inp \ - > synth_attr_impure.out 2>&1 - -user_event_1.out: user_event_1 user_event_1.inp user_event_spec - $(MDB_STD) ./user_event_1 < user_event_1.inp \ - > user_event_1.out 2>&1 - -user_event_2.out: user_event_2 user_event_2.inp user_event_spec_2 - $(MDB_STD) ./user_event_2 < user_event_2.inp \ - > user_event_2.out 2>&1 - -user_event_shallow.out: user_event_shallow user_event_shallow.inp \ - user_event_spec - $(MDB_STD) ./user_event_shallow < user_event_shallow.inp \ - > user_event_shallow.out 2>&1 - # When WORKSPACE is set, use $(WORKSPACE)/tools/lmc to compile the query. ifneq ($(origin WORKSPACE), undefined) export WORKSPACE @@ -701,9 +574,10 @@ endif # We pipe the output through sed to avoid differences for `--use-subdirs', # and to remove some spurious warnings that `gcc' and `ld' issue. -# XXX we should fix the spurious warnings about unresolved symbols. +# 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.) +# XXX Which is not an issue anymore. interactive.out: interactive.out.orig cat interactive.out.orig | \ sed \ @@ -716,22 +590,12 @@ interactive.out: interactive.out.orig -e 's/ from .*\/lib\/mercury\/inc\/mercury_imp.h:[0-9]*,.//' \ -e '/ from mdb_query.c:[0-9]*:$$/N' \ -e 's/ from mdb_query.c:[0-9]*:.//' \ - -e '/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/unistd.h:[0-9]*: warning: .cuserid. redefined$$/N' \ - -e 's/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/unistd.h:[0-9]*: warning: .cuserid. redefined.//' \ - -e '/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/stdio.h:[0-9]*: warning: this is the location of the previous definition$$/N' \ - -e 's/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/stdio.h:[0-9]*: warning: this is the location of the previous definition.//' \ - -e '/In file included from \/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/stdarg.h:[0-9]*,$$/N' \ - -e 's/In file included from \/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/stdarg.h:[0-9]*,.//' \ -e '/ from .*\/lib\/mercury\/inc\/mercury_library_types.h:[0-9]*,$$/N' \ -e 's/ from .*\/lib\/mercury\/inc\/mercury_library_types.h:[0-9]*,.//' \ -e '/ from .*\/lib\/mercury\/inc\/mercury_imp.h:[0-9]*,$$/N' \ -e 's/ from .*\/lib\/mercury\/inc\/mercury_imp.h:[0-9]*,.//' \ -e '/ from mdb_query.c:[0-9]*:$$/N' \ -e 's/ from mdb_query.c:[0-9]*:.//' \ - -e '/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/va-alpha.h:[0-9]*: warning: redefinition of .va_list.$$/N' \ - -e 's/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/va-alpha.h:[0-9]*: warning: redefinition of .va_list..//' \ - -e '/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/va_list.h:[0-9]*: warning: .va_list. previously declared here$$/N' \ - -e 's/\/usr\/local\/apps\/gcc-2.95.3\/lib\/gcc-lib\/alpha-dec-osf5.1\/2.95.3\/include\/va_list.h:[0-9]*: warning: .va_list. previously declared here.//' \ -e '/\/usr\/bin\/ld:$$/N' \ -e 's/\/usr\/bin\/ld:.//' \ -e '/\/bin\/ld:$$/N' \ @@ -746,8 +610,6 @@ interactive.out: interactive.out.orig -e 's/Warning: Unresolved:.//' \ -e '/$$/N' \ -e 's/.//' \ - -e '/$$/N' \ - -e 's/.//' \ -e '/__start$$/N' \ -e 's/__start.//' \ > interactive.out @@ -763,4 +625,4 @@ mdb_command_test.out: mdb_command_test mdb_command_test.inp | egrep "internal error in the trace help system" \ > mdb_command_test.out -#-----------------------------------------------------------------------------# +#---------------------------------------------------------------------------#