Commit Graph

72 Commits

Author SHA1 Message Date
Zoltan Somogyi
769412bec5 Attempt to fix a test failure in C# grades ...
... and make the set of test cases in the valid/valid_seq test directories
easier to handle.

tests/valid_seq/call_impure_in_opt_helper_1.m:
    Add a C# definition for a predicate that is defined entirely
    by foreign_procs.

tests/valid/Mmake.valid.common:
    Note the reason why many of the test cases using this file fail
    when executed in C# grades.

    Add a target that I used to debug that problem.

    Put the descriptions of a set of make variables in lexicographic order,
    except for OTHER_PROGS, which has to stay at thee end as it means
    "none of the above". Without this reordering, it was not clear that
    the cause of the failures was NOT a mistake in the spelling of
    one of these variable names.

tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
    Put the definitions of those make variables in the same order.

tests/Mmake.common:
    Improve programming style.
2023-10-02 19:01:03 +11:00
Julien Fischer
9656e13e73 Fix some declarative debugger test on Windows.
tests/declarative_debugger/Mmakefile:
    Filter memory addresses and error codes from the output of the
    condition_bug and sort tests.

tests/declarative_debugger/sort.exp:
    Conform to the above change.

tests/Mmake.common:
    Shut up an error from grep when a directory does not contain
    a FAILED_TESTS file.
2023-07-30 13:33:46 +10:00
Zoltan Somogyi
f290cffc7e Delete code to clean up obsolete files. 2020-10-16 07:27:26 +11:00
Zoltan Somogyi
be3f9443b1 Simplify the setup of mdbrc for tests.
We used to set up *two* mdbrc files for use by test cases:
scripts/test_mdbrc, and tests/mdbrc. Tools/bootcheck said
the tests should use the former, while tests/Mmake.common
said they should use the latter. This diff deletes the latter,
and uniformly uses the former.

The setup code was also scattered, with parts being done by
the configure script, and part being done by tools/bootcheck.
Move it all to scripts/Mmakefile, since that is the natural
place to put code to build scripts/test_mdbrc.

Mmakefile:
    Fix the action for cleaning up the tests directory.
    This started out as the reason for this whole change.
    As it happens, a *working* action for cleaning up the tests
    broke things, because it deleted an autoconfigured file
    (tests/mdbrc) that there was no rule for rebuilding.
    This issue is what required the rest of this diff.

    When doing "mmake clean/realclean", clean the extras as well.

configure.ac:
    Delete the code creating tests/mdbrc.in.

scripts/Mmakefile:
    Add a rule to build test_mdbrc, as mentioned above.

tests/Mmake.common:
    Switch to using scripts/test_mdbrc in test cases
    run under mdb.

    Mark the rules that clean up mdbrc and mdbrc.in
    as obsolete, since we will now stop creating those files.

tools/bootcheck:
    Delete the code that used to build tests/mdbrc. Instead,
    rebuild scripts/test_mdbrc (in case the workspace was moved),
    and use that.

tests/Mmakefile:
    When cleaning the tests directory, clean its subdirectories
    (since the top level directory does not have much clean).
2020-10-04 23:00:29 +11:00
Zoltan Somogyi
ac50b3cbd1 Do not use exceptions in options_file.m.
And add tests for how the compiler handles both valid and invalid
options files.

compiler/options_file.m:
    This diff rewrites options_file.m in a straightforward, direct style that
    returns indications of errors as error_specs rather than as exceptions.
    A recent diff started on this task; this diff finishes it.

    The new approach has several advantages.

    - The control flow is much simpler, and therefore more understandable.
      Correctness arguments for propositions such as "this code closes
      all the file streams that it opens" are now much simpler to make.

    - We now report errors using error_specs, which contain context
      information, while previously, each error was described only
      by a string, without context info.

    - Once we detect and report one error, we can continue to read the
      rest of the input. This allows a single compiler invocation to find
      and report several errors, not just the first.

    - Since we now return the gathered set of error_specs instead of printing
      them, the predicates of this file don't have to take globals structures
      as arguments, which allows our callers to avoid constructing those
      structures.

    - Deep profiling, which cannot handle exceptions, now works on
      the code of this module.

    Change over to using trace goals for debugging prints, since continuing
    to use debug_make_msg would require a globals structure.

    Add an XXX on a likely bug.

    Add a mechanism for writing out a database of variable names and values.

compiler/mercury_compile_main.m:
    Conform to the changes in options_file.m. Document where exactly
    we could avoid constructing a globals just for options_file.m.

    If the right option is given, get options_file to write out the database
    of variable names and values it has just read in, to enable the
    functionality of this module to be tested.

compiler/options.m:
doc/user_guide.texi:
    Add a new developer option, --dump-options-file, to control the above.

compiler/make.build.m:
compiler/make.m:
compiler/make.program_target.m:
    Conform to the changes in options_file.m.

compiler/file_util.m:
    Fix an error message.

tests/Mmakefile:
tools/bootcheck:
    List options_file and invalid_options_file as two new test directories.

    Fix a command in bootcheck.

tests/options_file/Mmakefile:
    Add a mechanism for testing whether options_file.m builds mapping
    from make variable names to values that we expect.

tests/Mmake.common:
    Provide a mechanism for comparing dumped options_files against
    their expected contents, for use by tests/invalid_options_file/Mmakefile.

    Fix a comment.

tests/options_file/basic_test.m:
tests/options_file/basic_test.optfile_exp:
tests/options_file/basic_test.options_file:
tests/options_file/basic_test.options_file.sub0:
tests/options_file/basic_test.options_file.sub1:
    A simple test case for exercising all the usual options_file constructs.

tests/invalid_options_file/Mmakefile:
    Add a mechanism for testing whether options_file.m generates
    the error messages we expect for various kinds of errors in options files.

tests/invalid_options_file/no_assign.{m,options_file,err_exp}:
tests/invalid_options_file/no_var.{m,options_file,err_exp}:
tests/invalid_options_file/nonexistent_file.{m,options_file,err_exp}:
tests/invalid_options_file/undefined_var.{m,options_file,err_exp}:
tests/invalid_options_file/unterminated_string.{m,options_file,err_exp}:
tests/invalid_options_file/unterminated_var.{m,options_file,err_exp}:
    Six test cases to test six different kinds of errors that can be
    detected by options_file.m.
2020-06-12 04:14:00 +10:00
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
Zoltan Somogyi
afe2887882 Remove stale references to test subdirs.
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.

tests/*/Mmakefile:
    Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
    was always set to "..", and SUBDIRS to the empty string.

    Delete any references to the make variable NOT_WORKING, since
    it is never used.

tests/Mmake.common:
    Document that Mmakefiles in test directories don't have to set
    TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
    of the make variables they do still have to set.

    Delete the targets and actions for handling subdirectories of
    test directories, since there aren't any.

tests/Mmakefile:
    Simplify some code.
2020-04-14 11:23:12 +10:00
Zoltan Somogyi
aea3b98033 Test the process of making .int files.
tests/Mmakefile:
tools/bootcheck:
    Add invalid_make_int and valid_make_int as new test directories.

tests/invalid_make_int/missing_interface_import.m:
tests/invalid_make_int/missing_interface_import.int_err_exp:
tests/invalid_make_int/missing_interface_import.int_err_exp2:
    Move this test case from invalid to invalid_make_int, since it was
    *already* testing the error message we get from "mmc --make-interface".

tests/invalid_make_int/Mercury.options:
tests/invalid_make_int/Mmakefile:
    Set up testing of whether we get the right error messages during
    the process of making .int files.

tests/Mmake.common:
    Provide a way for tests in invalid_make_int to compare a .int_err file
    against several .int_err_exp* files.

tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
    Delete references to the test case moved to invalid_make_int.

tests/valid_make_int/bug499.m:
    Add the test case that motivated this change.

tests/valid_make_int/Mercury.options:
tests/valid_make_int/Mmakefile:
    Set up testing of whether we can generate .int files for modules.
2020-04-13 04:14:51 +10:00
Peter Wang
3ccd665564 Produce unified diffs for test cases by default.
tests/Mmake.common:
    Set DIFF_OPTS=-u if not defined.
2019-06-28 15:07:38 +10:00
Peter Wang
fd24b2e331 Don't compress failed test executables.
Disk space isn't the concern that it used to be so compressing
failed test executables is mostly just a waste of time.

tests/run_one_test:
    Don't compress failed test executables.

tests/Mmake.common:
    Delete clean_zip target.

tests/*/.gitignore:
    Delete *.gz ignore patterns.
2018-07-31 16:32:41 +10:00
Julien Fischer
8bbef42cf3 Fix a typo.
tests/Mmake.common:
    As above.
2016-02-06 23:26:19 +11:00
Zoltan Somogyi
8a764392d9 Avoid warnings from make in test directories.
tests/Mmake.common:
    Don't invoke any actions in the clean_local and realclean_local
    targets, since if using mmc --make, the builtin mmake rules
    have actions for those targets as well, and make can't handle
    more than one action for a target having actions. Replace those
    actions with dependencies on other, unique targets that have
    the actions instead.

tests/*/Mmakefile:
    Avoid actions in clean_local and realclean_local targets the same way.

    Sort the test names in some directories that didn't already do so.

    Delete some obsolete comments.

    Fix style.

tests/valid/Mmake.valid.common:
    As for the Mmakefiles above, and also move the definition of a make
    variable before it is needed.
2015-09-08 05:57:53 +10:00
Zoltan Somogyi
e0cdfc2fe2 Make the tests really work in parallel.
There was a bug that prevented the tests in each directory from being run
in parallel, even when the mmake was invoked with e.g. -j4. The bug
was the absence of a '+' on an action that invoked tests/run_one_test.
Without that +, the make process inside the "mmake -j4 runtests_local"
command issued by bootcheck screwed up its connection with the recursive
make invoked by run_one_test, and apparently decided to stop using
parallelism. It was telling us this all this time but its messages,
which looked like this:

    make[2]: warning: -jN forced in submake: disabling jobserver mode.

were lost in the sea of other bootcheck output until my recent change
to run_one_test.

A single-character change fixes the bug; the rest of this big change is
dealing with the consequences of fixing the bug. Many test cases in
the hard_coded and valid directories contain nested modules, which
need to be compiled sequentially.

tests/Mmake.common:
    Fix the bug.

    Delete the duplicate "ALL TESTS SUCCEEDED" message from the runtests
    target, since the runtests_local target already prints a message
    to that effect. Make this message more emphatic.

tests/run_one_test:
    Make the output a bit easier to understand.

tests/hard_coded/*.{m,exp}:
tests/submodules/*.{m,exp}:
    Move the source files and expected output files of the test cases that
    use nested modules from hard_coded to submodules, since most of the tests
    in the hard_coded can be done in parallel, while the ones in submodules
    are already done in sequence.

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/submodules/Mmakefile:
tests/submodules/Mercury.options:
    Move the Mmakefile and Mercury.options entries of the moved test cases
    from hard_coded to submodules.

tests/valid_seq:
    A new test directory, to hold the test cases originally in tests/valid
    that contain nested modules. Moving these to a new directory, which
    forces -j1, allows us to execute the remaining ones in parallel.

tests/valid/*.m:
tests/valid_seq/*.m:
    Move the source files of the test cases that use nested modules
    from valid to valid_seq.

    In a few cases, clean up the test cases a bit.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid_seq/Mmakefile:
tests/valid_seq/Mercury.options:
tests/valid/Mmake.valid.common:
    Add valid_seq/Mmakefile to list the test cases now in valid_seq,
    and add valid_seq/Mercury.options to hold their option values.
    Delete the entries of those tests from valid/Mmakefile, and their option
    values from valid/Mercury.options. Unlike valid/Mmakefile,
    valid_seq/Mmakefile forces -j1.

    To avoid unnecessary duplication between the two Makefiles, put
    all the rules that both need into valid/Mmake.valid.common, and
    include this in both Mmakefiles.

tests/string_format/Mmakefile:
    Force -j1, since these tests share a library module.

tests/Mmakefile:
    List the new valid_seq directory among the others.

tests/bootcheck:
    Execute the tests in the new valid_seq directory as well as the others.

    Record when the execution of the test suite is started.

    Comment out invocations of set -x, since they add no useful information
    in the vast majority of cases. The comment sign can be removed if and
    when the information *would* be useful.

    Don't try to copy a nonexistent file. (The error message about this
    was also lost in the noise.)
2015-08-26 01:01:54 +10:00
Zoltan Somogyi
80354e5719 Fix comment layout. 2015-08-25 12:45:10 +10:00
Zoltan Somogyi
73f0a36719 Allow the use of -jN in many test directories.
tests/Mmake.common:
    Replace the -j1 in the runtests_local target used by all the test
    directories with $(MAYBE_J1).

tests/*/Mmakefile:
    Define MAYBE_J1 it as the empty string in test directories in which
    different tests don't share source files.

    Define MAYBE_J1 as -j1 in test directories in which
    different tests do share source files.

tests/submodules/sub2_a.m:
    Add this copy of sub_a.m to allow tests in the submodules directory
    to be done in parallel.

tests/submodules/accessibility2.m:
    Import sub2_a.m instead of sub_a.m.

tests/warnings/ambig_types_high_level.m:
    Add this copy of ambig_types.m to allow tests in the warnings directory
    to be done in parallel.

tests/warnings/ambig_high_level.m:
    Import ambig_types_high_level.m instead of ambig_types.m.
2015-02-19 06:02:45 +11:00
Zoltan Somogyi
de2f7b2a0c Flatten the test directories, step 2.
Specifically, rename the following subdirectories of the test directory:

    old dir name                new dir name

    analysis/ext                analysis_external
    analysis/ctgc               analysis_ctgc
    analysis/excp               analysis_excp
    analysis/table              analysis_table
    analysis/trail              analysis_trail
    invalid/purity              invalid_purity
    analysis/sharing            analysis_sharing
    hard_coded/purity           purity
    general/accumulator         accumulator
    analysis/unused_args        analysis_unused_args
    debugger/declarative        declarative_debugger
    hard_coded/exceptions       exceptions
    general/string_format       string_format
    hard_coded/sub-modules      submodules
    hard_coded/typeclasses      typeclasses
    general/structure_reuse     structure_reuse

Some subdirectories are still there, to wit, the subdirs of the inactive
test directory stm, each of which (if I remember correctly) holds only one
test case.

The general/structure_reuse directory previously wasn't enabled; I think
this was a bug.

tests/Mmakefile:
tools/bootcheck:
    List the new test directories.

tests/Mmake.common:
    The analysis_* directories each need to know whether the workspace
    uses subdirs. This used to be controlled from one place,
    analysis/Mmakefile, but since analysis_* are not subdirs of analysis,
    we need a new central place to find this out.

tests/analysis/common.sh:
    Update documentation for the move.

tests/OLDDIRS/Mmakefile:
    Set the subdir list to empty.

tests/NEWDIRS/Mmakefile:
    Update the "this" directory's name, as well as TESTS_DIR.

    In analysis_*/Mmakefile, use the new mechanism for detecting the presence
    of subdirs.
2015-02-10 00:44:14 +11:00
Zoltan Somogyi
44fa78388d Make tests/invalid/foreign_decl_line_number pass.
On my machine, this test has never passed in hlc.gc grade, because you get
extra output from gcc 4.8.1. This diff shuts up this extra output.

configure.ac:
tests/DEFNS_FOR_TESTS.in:
    Record whether the C compiler supports -fno-diagnostics-show-caret
    in the new file tests/DEFNS_FOR_TESTS.

tests/Mmake.common:
    Include tests/DEFNS_FOR_TESTS.

tests/invalid/Mmakefile:
    When invoking the foreign_decl_line_number test, and the related test
    foreign_type_line_number, specify -fno-diagnostics-show-caret
    if this is supported by the C compiler.
2015-02-01 04:03:55 +11:00
Julien Fischer
a8a6f14b84 Avoid warnings from mmake in the tests directory.
tests/Mmmake.common:
    Delete a left-over reference the the TARGET_ASM variable.
2013-03-21 15:39:18 +11:00
Peter Wang
320633b51a Fix a problem where an error code in a test subdirectory would not be
Branches: main

tests/Mmake.common:
        Fix a problem where an error code in a test subdirectory would not be
        propagated to parent directories.  Reported by Keri Harris.
2010-02-15 06:49:51 +00:00
Peter Wang
75771a9b6e Allow testing of java grade. Requires using `mmc --make' for now.
Branches: main

Allow testing of java grade.  Requires using `mmc --make' for now.
This patch does not attempt to fix test failures.

tests/Mmake.common:
        Delete unneeded Java-specific rule, which was broken.

tests/benchmarks/Mmakefile:
tests/general/Mmakefile:
tests/general/string_format/Mmakefile:
tests/grade_subdirs/Mmakefile:
tests/hard_coded/Mmakefile:
tests/recompilation/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
        Don't deliberately disable tests in java grade.

tests/*.m:
        Add Java foreign code.

        Write dummy procedures instead of abusing `:- external'.
2009-08-14 03:21:55 +00:00
Zoltan Somogyi
a1f69d35fc Fix Mantis bug #45, which was that mdb effectively ignored some commands
Estimated hours taken: 1.5
Branches: main

Fix Mantis bug #45, which was that mdb effectively ignored some commands
in .mdbrc files.

trace/mercury_trace_internal.[ch]:
trace/mercury_trace_command_queue.[ch]:
	Move the code for manipulating the command queue from
	mercury_trace_internal.c to a new module. This improves the level of
	abstraction. The ultimate cause of the bug was a lack of abstraction.

	The old code put commands from startup files in the command queue
	in a mixed order: respecting order within each startup file, but
	reversing order among startup files. The cause of the bug was
	that the commands from .mdbrc files were put into the queue
	*after* the commands from the system's standard startup file in time,
	but *before* them in order, so the commands in the standard startup
	file could override commands from .mdbrc files.

	The fix is to consistently put commands in order: from the standard
	system startup file, from .mdbrc, and from the environment.

	Give better names to some functions.

	Provide a mechanism for debugging the command queue mechanism.

trace/mercury_trace_cmd_backward.c:
	Use those better names.

trace/Mmakefile:
	Add the new module.

tests/debugger/mdbrc_test.{m,inp,exp,mdbrc}:
	Add a regression test for this bug, a minimally modified version
	of the bug demo program in Mantis.

tests/debugger/Mmakefile:
	Enable the new test case, which specifies its own .mdbrc file.

tests/Mmake.common:
	Provide a way for a test case to not use the .mdbrc file used by all
	the other debugger tests, so it could specify its own.
2008-02-20 02:59:38 +00:00
Julien Fischer
e3fdb5dd20 Suppress some warnings in the tests directory.
Estimated hours taken: 0
Branches: main

Suppress some warnings in the tests directory.

tests/Mmake.common:
	Pass -f to the rm commands used to delete mdbrc and mdbrc.in.

tests/.cvsignore:
	Ingore mdbrc and mdbrc.in.
2007-07-20 06:13:22 +00:00
Ian MacLarty
77a9eca744 Ignore lines that start with `#' in sourced mdb scripts.
Estimated hours taken: 1
Branches: main

Ignore lines that start with `#' in sourced mdb scripts.
This is useful for documenting mdb scripts.

Create a local copy of the mdbrc file so that we can test new mdb scripts
in the test suite.

NEWS:
	Mention the changes.

configure.in:
	Create a copy of mdbrc.in in the tests directory and create an mdbrc
	from this file using different substitutions than those used for the
	mdbrc that will be installed.  This is necessary so that we can use
	the local mdbrc file when running the tests.  Previously if the mdbrc
	file was changed (for example a new alias was added), then we had to
	install it before testing.

doc/user_guide.texi:
	Document the new behaviour of the source command.

scripts/mdb_grep:
scripts/mdb_open:
scripts/mdb_track:
	Add comments to these mdb scripts.

scripts/mdbrc.in:
	Use a different substitution variable for the location of mdb_doc,
	since for the test version of mdbrc mdb_doc will be in a different
	location to the other scripts.

tests/Mmake.common:
	Get mdb to use the local mdbrc when invoked for the tests.

	Clean mdbrc and mdbrc.in.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/debugger/scripts.exp:
tests/debugger/scripts.inp:
tests/debugger/scripts.m:
	Add a test case for the three existing mdb scripts.

trace/mercury_trace_readline.c:
trace/mercury_trace_readline.h:
	Rename MR_trace_readline_expand_args to MR_trace_readline_from_script
	and get it to ignore comment lines.

trace/mercury_trace_internal.c:
	Adapt to changes in mercury_trace_readline.h.
2007-06-19 03:12:51 +00:00
Zoltan Somogyi
3610401ad1 Fix a syntax error in this Mmakefile that prevented any tests from
Estimated hours taken: 4
Branches: main

tests/invalid/Mmakefile:
	Fix a syntax error in this Mmakefile that prevented any tests from
	being run in this directory since april 5 (when the error was
	introduced).

tests/Mmake.common:
tools/bootcheck:
	Keep a list of test directories in which we couldn't run mmake,
	and report any such to the user as errors.
2007-05-14 08:14:02 +00:00
Zoltan Somogyi
863874df85 Document my recent change implementing coverage testing.
Estimated hours taken: 6
Branches: main

Document my recent change implementing coverage testing. At the same time,
eliminate the old hack that allowed a file containing a list of file names to
be considered a trace count file. We haven't needed it since the addition of
mtc_union, and it can lead to incomprensible error messages. (The presence
of the old hack made documenting coverage testing harder.)

In the process, fix the tools code for rerunning failed test cases only.

doc/user_guide.texi:
	Document my recent change implementing coverage testing, and the
	elimination of the old hack.

mdbcomp/trace_counts.m:
	Modify the predicates for reading in trace count files along the lines
	above.

mdbcomp/slice_and_dice.m:
	Modify the predicates for reading in slices and dices along the lines
	above.

	Rename some function symbols to avoid ambiguities.

compiler/tupling.m:
slice/mcov.m:
slice/mtc_diff.m:
slice/mtc_union.m:
trace/mercury_trace_declarative.c:
	Conform to the changes above.

slice/mcov.m:
	Fix the usage message, which referred to this program by its old name
	mct.

	Allow the output to be restricted to a set of named modules only.
	This is to make testing easier.

slice/mtc_diff.m:
	Rename the long form of the -o option from --out to --output-file,
	to make it consistent with the other programs.

tests/run_one_test:
tools/bootcheck:
	Modify the algorithm we use to gather trace counts for the Mercury
	compiler from both passed and failed test cases to run mtc_union
	periodically instead of gathering all the trace counts file and keeping
	them to the end (which takes far too much disk space).

	Fix an old bug: gather trace counts from executions of the Mercury
	compiler only.

tests/debugger/Mmakefile:
tests/debugger/dice.passes:
	Modify the dice test case to compute the union of the trace counts for
	the passed versions of this test case to use mtc_union to create
	dice.passes, instead of having dice.passes statically contain the list
	of the names of the passed trace count files (since that capability
	is deleted by this diff).

tools/bootcheck:
tests/Mmake.common:
	Fix the code for rerunning failed tests only.

mdbcomp/prim_data.m:
	Eliminate some ambiguities in predicate names.

compiler/*.m:
	Conform to the change to prim_data.m.

compiler/error_util.m:
	Add reading files as a phase in error messages.

compiler/mercury_compile.m:
	Use the new facilities in error_util for printing an error message.
2006-10-02 05:21:44 +00:00
Julien Fischer
d13356c38e Add the trailing directory to the list of test dirs.
Estimated hours taken: 0
Branches: main

tools/bootcheck:
	Add the trailing directory to the list of test dirs.

tests/README:
	Add a note that the bootcheck script may need to be updated
	if a new (sub)directory is added to the test suite.

tests/Mmake.common:
	Fix an overlong line.
2006-01-25 07:03:44 +00:00
Zoltan Somogyi
8677205bd5 Print a timestamp when starting work on a directory.
Estimated hours taken: 0.1
Branches: main

tests/Mmake.common:
	Print a timestamp when starting work on a directory.
2005-08-08 02:27:27 +00:00
Zoltan Somogyi
d56de30e9d Remove most of the junk from the command lines executed by make when building
Estimated hours taken: 12
Branches: main

Remove most of the junk from the command lines executed by make when building
the compiler and by bootcheck when building test cases. We do this by moving
the junk into files consulted via the --flags option.

After this change, it is actually possible to see in a glance not just which
files are being compiled but also with which options. The size of the output
(measured in bytes) from a bootcheck is now only about 40% of what is was
before.

configure.in:
	Remember the path to the bootstrap compiler and the flags it should be
	invoked with separately. Put the flags into the FLAGS files in various
	directories.

	Test whether the default install directory actually exists, so that
	the -L and -R linker options referring to this directory are passed
	to the C compiler only if it does.

Mmake.common.in:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files.

	Conform to the changes in configure.in.

	Add a template rule for the dependencies of the FLAGS files.

Mmake.workspace:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files. In some cases, add references to the FLAGS
	files.

Mmakefile:
	When rebuilding Mmake.common, rebuild only Mmake.common, not all files
	created by configure.

analysis/ANALYSIS_FLAGS.in:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/PROF_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
profiler/DEEP_FLAGS.in:
slice/SLICE_FLAGS.in:
tests/TESTS_FLAGS.in:
	Add these files, which each contain the junk flags (the flags which are
	the same on every invocation and mostly just clutter up compiler
	command lines) that are needed on each compiler invocation in the
	relevant directory. Besides the results of configuration (word size
	etc), and the paths to other parts of the system, these files mostly
	control which warnings are enabled.

	Restrict the list of directories in -I options to what is sensible;
	for example, don't specify -I../analysis in the deep_profiler
	directory.

*/.nocopyright:
	Don't require copyright notices in FLAGS files, since that would make
	them invalid.

library/INTER_FLAGS:
	Add this file, which contains the flags enabled with intermodule
	optimization.

tests/WS_FLAGS.ws:
	Add this file. Unlike the .in files, which processed by config.status
	based on the results of autoconfiguration, this one is processed to
	specify the location of the workspace being tested.

analysis/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
tests/Mmakefile:
	Include the relevant directory's FLAGS file on the command line, to
	replace all the additions to MCFLAGS in ../Mmake.common and in
	../Mmake.workspace, and in some cases, the directory-specific Mmakefile
	itself.

	Build the directory's FLAGS file before executing the depend target,
	since most compiler options beyond --generate-dependencies come from
	there.

	Delete the FLAGS files generated by config.status when doing "make
	clean".

tests/Mmakefile:
	Allow the environment to define DIFF_OPTS.

runtime/Mmakefile:
	Use an option to tell config.status what to rebuild, not some
	environment variables.

tests/invalid/Mercury.options:
	For two test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the affected tests were compiled with before.

tests/invalid/*.err2:
	Update these expected files to account for the use of error_util
	in error messages by previous changes to the compiler. These expected
	output files are used only with --use-subdirs.

tests/warnings/Mmakefile:
	For all test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the tests were compiled with before.

scripts/prepare_tmp_dir_grade_part
	Copy the flags files when creating the subdirectories of tmp_dir.

scripts/mgnuc.in:
	Provide a mechanism, a per-directory .mgnuc_opts file, for specifying
	the options that are required for every C file in a directory. The
	intention is to use this for -I../library etc, but this is not done
	yet; one thing at a time.

tools/bootcheck:
	Copy the FLAGS files when creating stage2 and stage3.

	Don't specify the compiler options that are now in FLAGS files.

	Fill in the location of the workspace in tests/WS_FLAGS before running
	the tests.

	Provide a mechanism (a file ~/.bootcheck_diff_opts) to allow the user
	to specify what options to invoke diff with.

	Move the setting of MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE after
	we have built stage1, and always copy the profilers if --use-subdirs
	is set. The old ways of doing things caused problems if bootcheck
	was given --use-subdirs but stage1 doesn't use subdirs: the bootcheck
	modified the stage1 slice, profiler and deep_profiler directories.
2005-05-06 08:42:37 +00:00
Zoltan Somogyi
6ab59f41ab Provide a mechanism for gathering sets of trace counts from both passed and
Estimated hours taken: 6
Branches: main

Provide a mechanism for gathering sets of trace counts from both passed and
failed test cases.

runtime/mercury_trace_base.[ch]:
	Instead of writing out trace counts to a file with a fixed name,
	write it out to a file whose name includes the name of the executable
	and the process id.

	Export only the functions that need to be exported.

	Add sanity checking code that looks for and reports occurrences
	of a situation reported by Peter Wang: positive counts for internal
	events in a procedure with a missing (and hence zero) count for the
	CALL event of that same procedure. Make this sanity check conditional
	on the new configuration macro MR_TRACE_COUNT_DEBUG. The sanity check
	did not find any anomalies during any of my bootchecks.

runtime/mercury_conf_param.h:
	Document MR_TRACE_COUNT_DEBUG.

tests/Mmake.common:
tests/run_one_test:
	Move the code for executing one test from a very long action in
	Mmake.common to the new shell script run_one_test, to make it possible
	to edit it without having to worry about line continuations.

tests/run_one_test:
	Make the code for executing one test move the trace count files
	generated by the test, if any, to the directory for passed or failed
	test cases, and record their names.

	Add a mechanism for creating a timestamp file for each test.

tools/bootcheck:
	Clean up the files and directories containing trace counts information
	from a previous bootcheck before running the tests this time.

	Add an option --progress, that creates a timestamp file for each test.
	This allows users to gauge the rate at which bootcheck executes test
	cases, and provides the information required for detecting performance
	problems that manifest themselves as slow test case execution.

	Allow the --trace-count option to be spelt --trace-counts.

	Since run_one_test now gathers a list of failed test in a much cleaner
	format than before (a simple list of the names of failed test cases,
	complete with their directories), print this list at the end of the
	output. This saves having to grep for FAILED TEST in the output file.

	The existing --failing-tests option did "dumpster diving" to discover
	the list of failing test cases, and rerun only them. This behavior
	is still available as the --error-file option, but --failing-tests
	now uses the much simpler record of which tests failed to repeat
	only failed tests.

	The new --specified-test option allows the rerunning of only a single
	test. This way, "tools/bootcheck -b- -s debugger/queens" will rerun
	only the queens test in the debugger directory. While you can often
	compile and run test cases by hand, it is difficult to compile and
	run them the same way as bootcheck does, especially for multi-module
	programs. This way, one can use the bootcheck script as a scalpel,
	not a club.

	Make this file use four-space indentation.

tests/Mmake.common:
	Clean up any stray trace count files.

	Implement the infrastructure required for --specified-test.

tests/debugger/Mmakefile:
	Conform to the new naming scheme for trace counts files.
2005-03-24 01:58:12 +00:00
Ian MacLarty
b5550df746 Add mdb `dice' command which reads in a set of passing trace counts and a
Estimated hours taken: 40
Branches: main

Add mdb `dice' command which reads in a set of passing trace counts and a
failing trace count and prints a comparison table.  The table can be sorted
by various metrics and is useful for finding parts of a program executed in
a failing run, but not in passing runs.

browser/dice.m
	Add a new module for generating and manipulating a dice.

browser/mdb.m
	Add the dice module.

compiler/special_pred.m
mdbcomp/prim_data.m
	Move special_pred_name_arity/3 from compiler/special_pred.m to
	mdbcomp/prim_data.m so it can be used in dice.m.

doc/user_guide.texi
	Document the `dice' mdb command.  Also document the fact that the
	failing and passing slice file names can be set with the `set' mdb
	command.

	Move the `set' command to the misc section from the browser section
	since it now also sets the passing and failing slice file names, which
	have nothing to do with the browser.

library/list.m
	Add map4, map5 and map6 since map6 is needed in dice.m.

mdbcomp/program_representation.m
	Add a predicate to convert a goal path to a string.

mdbcomp/trace_counts.m
	Convert string_to_trace_port into a predicate and add a new mode so
	that a port can be converted back to a string.

runtime/mercury_trace_base.h
trace/mercury_trace_util.h
	Move the MR_TRACE_USE_HP and MR_TRACE_CALL_MERCURY macros to
	runtime/mercury_trace_base.h, so that they can be called from
	browser/dice.m.

tests/Mmake.common
	Clean up trace counts (which are generated to test the `dice' command).

tests/debugger/Mmakefile
tests/debugger/dice.exp
tests/debugger/dice.exp2
tests/debugger/dice.inp
tests/debugger/dice.m
tests/debugger/dice.passes
	Test the `dice' command.

trace/mercury_trace_internal.c
	Add the mdb `dice' command and modify the `set' command so the
	`fail_trace_count' and `pass_trace_counts' parameters can be set.

	Add a function to print a dice.

	Move the `set' command to the misc help section.
2005-02-10 04:10:33 +00:00
Fergus Henderson
c9d2e670fa Generate more informative output when *.err doesn't match *.err_exp,
Estimated hours taken: 0.25
Branches: main

tests/Mmake.common:
	Generate more informative output when *.err doesn't match *.err_exp,
	similar to the way we already do this when *.out doesn't match *.exp.
2004-02-24 08:34:34 +00:00
Simon Taylor
845865d061 Allow DIFF_OPTS to be overridden in tests/Mmake.params.
Estimated hours taken: 3
Branches: main

tests/Mmake.common:
	Allow DIFF_OPTS to be overridden in tests/Mmake.params.
2003-01-29 08:12:25 +00:00
Simon Taylor
5144b69d5d Add `.PRECIOUS: %.res %.err_res %.out %.err',
Estimated hours taken: 0.1
Branches: main, release

tests/Mmake.common:
	Add `.PRECIOUS: %.res %.err_res %.out %.err',
	so that files matching those patterns aren't
	removed except by `mmake realclean'.
2003-01-21 06:15:01 +00:00
Simon Taylor
145b06829c The target to build the executable on Windows is
Estimated hours taken: 0.1
Branches: main, release

tests/Mmake.common:
	The target to build the executable on Windows is
	`main_module', not `main_module.exe'.
2003-01-16 04:51:07 +00:00
Michael Wybrow
483d0c71a2 Modifications to the test suite to allow testing in grade java.
Estimated hours taken: 14
Branches: main

Modifications to the test suite to allow testing in grade java.


mercury/tools/test_mercury:
        Set-up the required CLASSPATH variable.

tests/Mmake.common:
        Added a rule to build `.out' files when the grade is java.

tests/benchmarks/Mmakefile:
        Enable only the working tests for the benckmarks directory.

tests/dppd/Mmakefile:
tests/general/Mmakefile:
tests/general/accumulator/Mmakefile:
tests/general/string_format/Mmakefile:
tests/general/structure_reuse/Mmakefile:a
tests/grade_subdirs/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/exceptions/Mmakefile:
tests/hard_coded/purity/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/hard_coded/typeclasses/Mmakefile:
tests/recompilation/Mmakefile
tests/term/Mmakefile:
tests/valid/Mmakefile:
        Disable test cases for grade java.

tests/recompilation/test_functions:
        Add framework needed to do recompilation testing for the java grade.
2003-01-12 22:33:35 +00:00
Michael Wybrow
5109e57e7d Prevent the test system from recursively starting mmake processes if the
Estimated hours taken: 5
Branches: main

Prevent the test system from recursively starting mmake processes if the
PROGS variable for any test directory contains just whitespace.

tests/Mmake.common:
	Make use of the $(strip string) command to remove whitespace from
	the list of tests before we check if this list is empty.
2003-01-10 05:19:03 +00:00
Simon Taylor
2da696c36b Fix tests/grade_subdirs failures on Windows:
Estimated hours taken: 0.2
Branches: main, release

tests/Mmake.common:
	Fix tests/grade_subdirs failures on Windows:
		s/%.out: %/%.out: %$(EXE_EXT)/
2002-11-30 14:33:15 +00:00
Simon Taylor
f54785ecd6 Fix a problem with parallel make where test directories were
Estimated hours taken: 3
Branches: main

tests/Mmake.common:
	Fix a problem with parallel make where test directories were
	not being cleaned up properly after failures because too many
	processes were being created by the `mmake -j10 realclean_local'
	in each directory, exceeding the per-user process limit. This
	caused spurious test failures on murlibobo.
2002-11-03 14:28:10 +00:00
Fergus Henderson
92ee87a064 Fix a bug with the code for re-runnning just the tests that
Estimated hours taken: 0.25
Branches: main

tests/Mmake.common:
	Fix a bug with the code for re-runnning just the tests that
	failed last time: don't try to run tests from a subdirectory in
	the parent directory.
2002-10-18 04:59:41 +00:00
Fergus Henderson
9e30af32fc Handle ".exe" extensions when gzipping executables for failed
Estimated hours taken: 0.25
Branches: main

tests/Mmake.common:
	Handle ".exe" extensions when gzipping executables for failed
	test cases.
2002-10-16 04:35:31 +00:00
Fergus Henderson
469e247db0 Various bug fixes and improvements:
Estimated hours taken: 1
Branches: main

tests/Mmake.common:
	Various bug fixes and improvements:
	- Fix a couple of bugs in stayl's change to add support for .exp4
	  and .exp5 files: it wasn't cleaning up any existing .res4 and
	  .res5 files before doing the comparison, and it wasn't taking
	  the .res4 and .res5 files into account when choosing the smallest
	  diff.
	- Concatenate the FAILED_TEST files from sub-directories into the
	  FAILED_TEST file in the parent directory.
2002-09-30 05:09:53 +00:00
Fergus Henderson
60d630a028 Various bug fixes and improvements:
Estimated hours taken: 4
Branches: main

tests/Mmake.common:
	Various bug fixes and improvements:
	- Make sure that we create the runtests.errs file when the tests fail.
	  (Due to a bug, it was only being created when the tests all pass!)
	- Don't remove the *.log files and the subdirectory runtests.errs
	  files if the tests fail; these are useful, even if their contents
	  is duplicated in the top-level runtests.errs.
	- Output "PASSED test(s)" rather than "FINISHED test(s)" when tests
	  complete successfully.
	- Include the grade in the "PASSED test" message, not just in
	  the "FAILED test" message.
	- Include "with --target asm" in the messages about the grade,
	  if --target asm was specified.
2002-09-24 20:37:39 +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
Simon Taylor
539feafe3d Don't run the tests in each directory in parallel.
Estimated hours taken: 0.2
Branches: main

tests/Mmake.common:
	Don't run the tests in each directory in parallel.
	This avoids problems with targets being made by multiple
	mmake processes at the same time, and being cleaned up
	before all users are finished with them. The subdirectories
	are still run in parallel.

	The %.log targets now return an exit status of 1
	if the test fails.
2002-09-05 12:35:59 +00:00
Zoltan Somogyi
6b4f2a4fac Centralize the MDB make variable in tests/Mmake.common.
Estimated hours taken: 0.1
Branches: main

Centralize the MDB make variable in tests/Mmake.common.

tests/Mmake.common:
	Define MDB here, and make it override $HOME.

tests/debugger/Mmakefile:
tests/debugger/declative/Mmakefile:
	Delete the definition of MDB.

tools/bootcheck:
	Delete the overriding of $HOME.
2002-09-02 03:40:40 +00:00
Zoltan Somogyi
0ce9727928 Build a file in each test directory containing the names of the failed
Estimated hours taken: 0.2
Branches: main

tests/Mmake.common:
	Build a file in each test directory containing the names of the failed
	test cases in that directory.
2002-08-30 06:07:23 +00:00
Simon Taylor
65bc1de557 Avoid syntax errors where there are no tests.
Estimated hours taken: 0.1
Branches: main

tests/Mmake.common:
	Avoid syntax errors where there are no tests.
2002-08-19 04:40:04 +00:00
Simon Taylor
47a4d62dc1 Improve the test framework to make it easier to find out which tests
Estimated hours taken: 30
Branches: main

Improve the test framework to make it easier to find out which tests
failed and to reduce disk usage (important in debug grades).

Allow the tests to be run with `mmc --make' (still some failures).

Allow the user to run only the failing tests from a previous
run by using `mmake ERROR_FILE=runtests.errs', where runtests.errs
is the log file from the previous run.

tests/Mmake.common:
tests/*/Mmakefile:
	Move common code (such as the code to deal with subdirectories)
	to Mmake.common.

	Run the tests using `mmake runtests' rather than using slightly
	different runtests scripts in each directory.

	Add to the output from `mmake runtests' to make it easier to
	identify which tests failed in which grades.

	Move per-module options into Mercury.options files so they
	can be read by `mmc --make'.

	Remove the last of the NU-Prolog support.

	Consistently use the main module name when listing tests.
	Some directories (e.g. invalid) were using the source file
	name.

tests/process_log.awk:
	Collect the parts of the output relating to failing tests.

tests/generate_exp:
tests/handle_options:
tests/subdir_runtests:
tests/startup:
tests/shutdown:
tests/*/runtests:
tests/recompilation/TESTS:
	Removed.

tests/recompilation/test_functions:
	Make sure the old result file is removed before starting
	each test.

	Put the mmake output for tests which are supposed to fail
	into a different file for each test.

tests/warnings/Mmakefile:
	Use %.c rather than $(cs_subdir)%.c in a rule.
	The $(cs_subdir) part doesn't work with `mmc --make',
	and isn't necessary any more (modules.m generates a rule
	`module.c: $(cs_subdir)module.c').

tests/README:
	Updated.

tools/bootcheck:
tools/test_mercury:
	Use `mmake runtests' instead of the `runtests' script.

	Add a `-f' (`--failing-tests') option to bootcheck which
	runs only the failing tests from the last run.

tools/test_mercury:
tools/run_all_tests_from_cron:
	Use the new framework to summarize test failures.
2002-08-17 13:52:35 +00:00
Simon Taylor
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
2002-04-29 08:22:08 +00:00
Simon Taylor
89c0cc8f6a Handle differences in the output depending on whether the
Estimated hours taken: 0.2

tests/debugger/completion.exp2:
tests/debugger/completion.exp4:
tests/debugger/completion.exp5:
	Handle differences in the output depending on whether the
	declarative debugger is enabled or disabled.

tests/Mmake.common:
	Handle `.exp4' and `.exp5' files.
2002-04-14 08:54:34 +00:00