Commit Graph

10 Commits

Author SHA1 Message Date
Zoltan Somogyi
59b11f84ce Update the debugger test directory.
Replace __ with . as the module qualifier symbol.

Replace references to io.state with just io.

Replace DCGs with state variables.

Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.

Replace if-then-elses with switches when possible and where this does not
affect what is being tested.

Replace separate pred and mode declarations with predmode declarations.

Put predicate and function declarations just before the definition
of the predicate or function.

Delete unneeded module qualifications on predicate and function declarations
and definitions.

Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.

For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
2018-08-28 21:20:59 +10:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Ian MacLarty
cab3c62fe7 Remove call depth numbers from standardized event printing.
Estimated hours taken: 2
Branches: main

Remove call depth numbers from standardized event printing.  This will make
maintaining the debugger test cases easier since a lot of the expected outputs
differ only in the call depth of their events, because of deep tracing of the
standard library in the decldebug grade.

Not all the debugger tests are run with standardized event printing, so
printing of call depths will still be exercised.

tests/debugger/breakpoints.exp
tests/debugger/breakpoints.exp2
tests/debugger/browser_test.exp
tests/debugger/exception_cmd.exp
tests/debugger/exception_cmd.exp2
tests/debugger/exception_cmd.exp3
tests/debugger/exception_value.exp
tests/debugger/exception_value.exp2
tests/debugger/exception_vars.exp
tests/debugger/existential_type_classes.exp
tests/debugger/existential_type_classes.exp2
tests/debugger/exported_eqv_type.exp
tests/debugger/higher_order.exp
tests/debugger/interpreter.exp2
tests/debugger/lambda_expr.exp
tests/debugger/loopcheck.exp3
tests/debugger/loopcheck.inp2
tests/debugger/nondet_stack.exp
tests/debugger/nondet_stack.exp2
tests/debugger/polymorphic_output.exp
tests/debugger/polymorphic_output.exp2
tests/debugger/polymorphic_output.exp3
tests/debugger/print_goal.exp
tests/debugger/print_table.exp
tests/debugger/queens.exp
tests/debugger/queens.exp2
tests/debugger/resume_typeinfos.exp
tests/debugger/retry.exp
tests/debugger/retry.exp2
tests/debugger/tabled_read.exp
tests/debugger/tabled_read_decl.exp
tests/debugger/tabled_read_unitize.exp
tests/debugger/type_desc_test.exp
tests/debugger/declarative/aadebug.exp
tests/debugger/declarative/app.exp
tests/debugger/declarative/args.exp
tests/debugger/declarative/big.exp
tests/debugger/declarative/filter.exp
tests/debugger/declarative/if_then_else.exp
tests/debugger/declarative/input_term_dep.exp
tests/debugger/declarative/io_stream_test.exp
tests/debugger/declarative/io_stream_test.exp2
tests/debugger/declarative/output_term_dep.exp
tests/debugger/declarative/propositional.exp
tests/debugger/declarative/remember_modes.exp
tests/debugger/declarative/special_term_dep.exp
tests/debugger/declarative/tabled_read_decl.exp
tests/debugger/declarative/trust.exp
	Remove call depth numbers from output run with standardized event
	printing.

trace/mercury_trace_internal.c
	Remove call depth from standardized event printing.
2004-11-16 00:16:44 +00:00
Zoltan Somogyi
759f76a314 Make debugging of minimal model tabling more convenient.
Estimated hours taken: 1.5
Branches: main

Make debugging of minimal model tabling more convenient.

compiler/handle_options.m:
	Make -Dmm generate HLDS dumps tailored for understanding the
	code of procedures transformed by minimal model tabling.

runtime/mercury_minimal_model.c:
	When printing the stack segments being saved, print the values of
	variables in the affected stack frames.

runtime/mercury_stack_trace.c:
	When dumping the nondet stack, print the name of the procedure
	that established each ordinary frame, and the goal path at which
	control will reenter the stack frame, if this information is available.

	Since mercury_minimal_model.c now asks for the printing of variable
	values (which is done by Mercury code) while execution is outside
	the debugger and hence while execution tracing may be enabled,
	explicitly turn off debugging while in the Mercury code that prints
	variable values.

runtime/mercury_trace_base.[ch]:
	Provide a simple mechanism for turning off debugging functionality
	in a region of code.

trace/mercury_trace_internal.c:
	Use the new mechanism in mercury_trace_base to handle turning off
	debugging output inside the debugger. This also allows us to simplify
	the code implementing the "flag" mdb command.

	Make the reports generated by the "unhide_events" and "table_io"
	commands follow the same format as other commands.

	Note that mercury_trace_declarative.c doesn't use the new mechanism,
	because it wants the reexecution of the call being debugged to be
	exactly the same as its first execution; in particular, turning off
	I/O tabling for reexecution would generate incorrect results.

tests/debugger/nondet_stack.exp*:
tests/debugger/tabled_read.exp*:
tests/debugger/tabled_read_decl.exp*:
tests/debugger/tabled_read_unitize.exp*:
tests/debugger/io_stream_test.exp*:
tests/debugger/declarative/tabled_read_decl.exp*:
	Update the expected out of these test cases to reflect the new
	functionality above.
2004-03-10 04:31:06 +00:00
Ralph Becket
a8ffd3680c Change the compiler and tools so that .' and not :' is now used as the
Estimated hours taken: 14
Branches: main

Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.

Infix `.' now has associativity yfx and priority 10.

NEWS:
	Report the change.

configure.in:
	Amend the test for an up-to-date Mercury compiler to check whether
	it recognises `.' as a module qualifier.

compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
	Change `:' to `.' as module separator for output.

compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
	As above.
	Fixed a bug where `.' was not being recognised as a module separator.

doc/reference_manual.texi:
	Report the change.

library/term_io.m:
	Ensure that infix `.' is written without surrounding spaces.

tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
	Test case added.
2003-01-17 05:57:20 +00:00
Zoltan Somogyi
d9122a1b30 Document I/O tabling, after cleaning it up for public use.
Estimated hours taken: 6
Branches: main

Document I/O tabling, after cleaning it up for public use.

We have previously implemented two forms of I/O tabling. One tables
only the output arguments of each primitive; this allows transparent
retries across I/O. The other tables all the arguments and the name
of the predicate; this allows transparent retries across I/O, the
declarative debugging of code that does I/O, and the printing of tabled
I/O actions. Since we now support declarative debugging in the standard
debugging grades, standardize on the second form of I/O tabling, and
make the first form accessible to implementors only, via a deliberately
undocumented option. This option, --trace-table-io-only-retry, is sort of
the inverse of the old option --trace-table-io-decl, which this change
deletes. (Only "sort of" because --trace-table-io-decl used to turn on
I/O tabling, whereas --trace-table-io-only-retry is consulted only if
I/O tabling is turned on by some other mechanism.)

NEWS:
	Mention I/O tabling.

compiler/options.m:
	Delete --trace-table-io-decl, and add --trace-table-io-only-retry.

	Update documentation.

compiler/table_gen.m:
	Base decisions on --trace-table-io-only-retry, not
	--trace-table-io-decl.

compiler/handle_options.m:
	Delete an implication involving --trace-table-io-decl that is now
	unnecessary.

doc/user_guide.texi:
	Document the idea of I/O tabling, and move the table_io command
	out of the list of developer only commands into a category of its own
	(since it doesn't naturally fit anywhere else).

	Change the old mismatched "table_io start" "table_io end" pair to
	the matched "table_io start" "table_io stop" pair.

	Document the variants of the print and browse commands that print and
	browse I/O actions.

	Be consistent about formatting of categories of mdb commands.

	Comment out some obsolete material in the documentation of retry.

doc/generate_mdb_doc:
	Include the new table_io category in the list of mdb command
	categories.

	Squeeze out repeated blank lines in the automatically generated
	documentation, to make maximum use of screen real estate.

doc/squeeze:
	A new script to do the squeezing.

doc/mdb_categories:
	Include the new table_io category in the list of mdb command
	categories.

runtime/mercury_trace_base.[ch]:
	Add a new global variable MR_io_tabling_allowed. It is initialized
	to TRUE in debugging grades and FALSE in other grades.

trace/mercury_trace_internal.c:
	Accept "table_io begin" and "table_io end" as well as "table_io start"
	and "table_io stop". Consistently use "start" and "stop" in output.

	Make "table_io" print a message saying the executable is not set up
	for I/O tabling unless MR_io_tabling_allowed is set.

	Add a new command, "table allow", that sets MR_io_tabling_allowed to
	TRUE. In debugging grades, this has no effect. In other grades, it
	allows I/O tabling, even though some parts of the program may have
	been compiled with --trace-table-io and some without. This
	inconsistency can yield weird results, which is why this command is
	deliberately undocumented. However, we can use it in a disciplined
	fashion to test I/O tabling even in nondebugging grades, thus spotting
	any regression in this area more quickly than if we tested I/O tabling
	only in debugging grades.

tests/debugger/Mercury.options:
tests/debugger/declarative/Mercury.options:
	Delete all occurrences of --trace-table-io-decl, since its effect is
	now the default.

tests/debugger/mdb_command_test.inp:
	Move the location of the table_io command test in this autogenerated
	file to reflect its move to a new category.

tests/debugger/tabled_read*.{inp,exp}:
tests/debugger/declarative/tabled_read*.{inp,exp}:
	Execute "table_io allow" before trying to turn on I/O tabling, since
	this is now required in non-debugging grades.

	Reflect the change in terminology: expect "stopped", not "ended",
2002-10-22 04:36:26 +00:00
Zoltan Somogyi
5345fa4643 Fix (most of) the expected outputs of the debugger test cases after my recent
Estimated hours taken: 2
Branches: main

Fix (most of) the expected outputs of the debugger test cases after my recent
changes. In some cases, this involved modifying the input scripts to make tests
less dependent on event numbers.

tests/debugger/Mmakefile:
	Use MDB_STD instead of MDB for more test cases than before.

	Disable the output_term_dep test case, since it doesn't actually test
	anything that the other test cases don't test, and it prints so many
	events that its .exp files depend on event numbers far too much.

tests/debugger/*.exp*:
tests/debugger/*.inp:
	Update expected outputs, and in some cases, the inputs.
2002-09-13 03:37:45 +00:00
Zoltan Somogyi
5f20c37b7a Add a mechanism for standardizing the event and call sequence numbers in
Estimated hours taken: 4
Branches: main

Add a mechanism for standardizing the event and call sequence numbers in
debugger output. The mechanism is a global flag whose value is set from
MERCURY_OPTIONS. It is intended to be used only in our own internal testing.

runtime/mercury_trace_base.[ch]:
	Define the global, MR_standardize_event_details.

	Move the documentation of several globals from the .c to the .h file,
	since that is where their users will look. Put those globals in a
	consistent order.

	Add functions for standardizing event and call sequence numbers,
	and use them when printing event details.

runtime/mercury_wrapper.c:
	Set MR_standardize_event_details when given the option -de.

runtime/mercury_stack_trace.c:
library/exception.m:
trace/mercury_trace_internal.m:
	Respect MR_standardize_event_details.

tests/Mmake.common:
	Define the make variable MDB_STD, which is like MDB except it also
	puts -de in MERCURY_OPTIONS.

tests/debugger/Mmakefile:
	Use MDB_STD instead of MDB for test cases that can benefit from
	standardizing event and call sequence numbers.

	Put the rules for the test cases in alphabetical order.

tests/debugger/*.exp*:
	Update expected outputs after this change.
2002-09-11 07:20:31 +00:00
Zoltan Somogyi
83b81e274a Add an option to the mdb retry command, -a or --allow-io, whose effect is
Estimated hours taken: 1
Branches: main

Add an option to the mdb retry command, -a or --allow-io, whose effect is
that it makes mdb allow retries over I/O without asking the user a question.
Since the exact form of this question depends on compilation options,
this should make it easier to write expected output files for test cases.

trace/mercury_trace_internal.c:
	Implement the new option.

doc/user_guide.texi:
	Document the new option.

tests/debugger/tabled_read_unitize.{inp,exp*}:
	Use the new option.
2002-07-29 11:16:01 +00:00
Zoltan Somogyi
41724c68de Add two new annotations for foreign_procs, tabled_for_descendant_io and
Estimated hours taken: 16
Branches: main

Add two new annotations for foreign_procs, tabled_for_descendant_io and
tabled_for_io_unitize.

By adding the tabled_for_descendant_io annotation to a foreign_proc with I/O
states, the programmer is asserting that the foreign_proc itself doesn't do
I/O, and nor does any foreign language code it calls, though the Mercury
predicates it calls may.

By adding the tabled_for_io_unitize annotation to a foreign_proc with I/O
states, the programmer is saying that both the foreign_proc itself and the
Mercury predicates it calls may do I/O. To avoid the I/O tabling problems
that would arise on retries from Mercury code called by the foreign_proc,
the programmer is requesting that the debugger treat calls to the foreign_proc
as a unit. This means that if I/O tabling is turned on, then the implementation
will disable both debugging and I/O tabling inside Mercury code called from
the foreign_proc.

compiler/prog_data.m:
	Add the tabled_for_descendant_io and tabled_for_io_unitize annotations.

	Parameterize the eval_table_io eval_method to accommodate the
	unitization of foreign_procs.

compiler/prog_io_pragma.m:
	Add code to read in the tabled_for_descendant_io and
	tabled_for_io_unitize annotations.

compiler/table_gen.m:
	Handle the new annotations. Procedures with tabled_for_descendant_io
	annotations don't need to be transformed at all; procedures with
	tabled_for_io_unitize annotations need a small variation of the
	existing transformation.

	Fix an existing bug that made the HLDS not type-correct. Create new
	variables with the appropriate type; do not assume all new variables
	are c_pointers, since some are integers.

library/table_builtin.m:
	Add two new predicates that table_gen.m emits calls to on either side
	of the code of foreign_procs with tabled_for_io_unitize annotations.

compiler/hlds_out.m:
compiler/layout_out.m:
compiler/mercury_to_mercury.m:
	Update the mechanisms for printing out eval methods.

compiler/hlds_pred.m:
	Update the mechanisms for performing tests on eval methods.
	Change some of the predicates involved to functions, partly in order
	to make future maintenance easier.

compiler/det_analysis.m:
compiler/det_report.m:
compiler/make_hlds.m:
compiler/modes.m:
	Conform to the change from predicates to functions.

runtime/mercury_trace_base.c:
	Update the documentation of MR_trace_enabled.

runtime/mercury_stack_layout.h:
	Add names for the new eval methods.

trace/mercury_trace.c:
	Handle the new eval methods.

tests/debugger/tabled_read_unitize.{m,inp,exp,data}:
	A new test case to check the handling of unitized foreign_procs.

tests/debugger/Mmakefile:
	Turn on the new test case.
2002-07-26 04:20:14 +00:00