[m-rev.] for review: document coverage testing

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Sep 25 12:01:21 AEST 2006


For review by Ian. The test case for coverage testing will come after this
diff is committed.

Zoltan.

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.

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.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/tupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tupling.m,v
retrieving revision 1.30
diff -u -b -r1.30 tupling.m
--- compiler/tupling.m	22 Sep 2006 03:50:45 -0000	1.30
+++ compiler/tupling.m	22 Sep 2006 05:02:37 -0000
@@ -160,8 +160,7 @@
         report_warning("Warning: --tuple requires " ++
             "--tuple-trace-counts-file to work.\n", !IO)
     ;
-        read_trace_counts_source(no, try_single_first, TraceCountsFile,
-            Result, !IO),
+        read_trace_counts_source(TraceCountsFile, Result, !IO),
         (
             Result = list_ok(_, TraceCounts),
             tuple_arguments_2(!ModuleInfo, TraceCounts, !IO)
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.492
diff -u -b -r1.492 user_guide.texi
--- doc/user_guide.texi	15 Sep 2006 11:14:38 -0000	1.492
+++ doc/user_guide.texi	24 Sep 2006 12:16:14 -0000
@@ -3713,13 +3713,12 @@
 that contains a summary of the program's execution
 This summary is called a slice.
 Copy the generated slice to a new file for each test case,
-to end up with some passing slices,
-say @samp{pass1}, @samp{pass2}, @samp{pass3}, etc.
-and a failing slice, say @samp{fail}.
- at sp 1
-Once one or more passing slices
-and a failing slice have been generated the @samp{dice} command
-can be used to display a table of statistics
+to end up with a failing slice, say @samp{fail},
+and some passing slices, say @samp{pass1}, @samp{pass2}, @samp{pass3}, etc.
+Union the passing slices with a command such as
+ at samp{mtc_union -p passes pass1 pass2 pass3}.
+ at sp 1
+The @samp{dice} command can use these files to display a table of statistics
 comparing the passing test runs to the failing run.
 Here is an example of a dice displayed in an mdb session:
 @sp 1
@@ -3772,8 +3771,8 @@
 @samp{-f} or @samp{--fail-trace-counts} option or with a separate 
 @samp{set fail_trace_count @var{filename}} command.
 @sp 1
-The name of a file containing a list of the files containing the passing
-slices can be given with the @samp{-p} or @samp{--pass-trace-counts} option.
+The name of the file containing the union of the passing slices
+can be given with the @samp{-p} or @samp{--pass-trace-counts} option.
 Alternatively a separate @samp{set pass_trace_counts @var{filename}} command
 can be given.  See @ref{Trace counts} for more information about trace counts.
 @sp 1
@@ -4703,37 +4702,36 @@
 @node Trace counts
 @section Trace counts
 
-A program with debugging enabled may be run in a special mode that causes it
-to write out a summary of its execution to a file.
-This summary is called a @emph{trace count} or @emph{slice}.
-A slice is a record of how many times each @emph{label} in the program was
-executed for a particular run.
-A label is a point in the source code where a debugger event,
-such as CALL or EXIT,
-can be triggered.
-
-Slices are useful for determining what parts of a failing program are being run
-and possibly causing the failure.
-Slices from failing and passing runs can be compared to see which parts of the
-program are being run in the failing runs,
-but not the passing runs.
+A program with debugging enabled may be run in a special mode
+that causes it to write out to a @emph{trace count file}
+a record of how many times each @emph{debugger event} in the program
+was executed during that run.
+
+Trace counts are useful for determining
+what parts of a failing program are being run
+and possibly causing the failure;
+this is called @emph{slicing}.
+Slices from failing and passing runs can be compared
+to see which parts of the program are being executed during failing runs,
+but not during passing runs; this is called @emph{dicing}.
 
 @menu
 * Generating trace counts::
+* Combining trace counts::
 * Slicing::
 * Dicing::
-* Combining trace counts::
+* Coverage testing::
 @end menu
 
 @node Generating trace counts
 @subsection Generating trace counts
 
-To generate a slice for a program run, first compile the program with deep
-tracing enabled
-(either by using the @samp{--trace deep} option or
-compiling the program in a debugging grade). 
-Then invoke the program with the mtc script, passing any required
-arguments after the program name.
+To generate a slice for a program run,
+first compile the program with deep tracing enabled
+(either by using the @samp{--trace deep} option
+or by compiling the program in a debugging grade).
+Then invoke the program with the @samp{mtc} script,
+passing any required arguments after the program name.
 @sp 1
 For example:
 @sp 1
@@ -4741,26 +4739,87 @@
 mtc ./myprog arg1 arg2
 @end example
 @sp 1
-The program will run as usual, except that when it terminates it will write
-a summary of the run to a file.
+The program will run as usual, except that when it terminates
+it will write the number of times each debugger event was executed
+to a trace count file.
 @sp 1
 @samp{mtc} accepts an @samp{-f} or @samp{--output-file} option.
-The argument to this option is the filename to use for the generated
-trace count file.
-If this option is not given then the trace count will be written to a
-file with the prefix @samp{.mercury_trace_counts}
-and a unique suffix.
- at sp 1
-The generated slice can then be analysed by the @samp{mslice}
-and @samp{mdice} tools.
-It can also be used to help direct a declarative debugging search
+The argument to this option is the filename to use
+for the generated trace count file.
+If this option is not given,
+then the trace count will be written to a file
+with the prefix @samp{.mercury_trace_counts} and a unique suffix.
+ at sp 1
+Ordinarily, the generated trace count file will list
+only the debugger events that were actually executed during this run.
+However, it will list all debugger events, even unexecuted ones,
+if @samp{mtc} is given the @samp{-c} or @samp{--coverage-test} option.
+ at sp 1
+ at samp{mtc} also supports two more options intended for coverage testing:
+ at samp{-s} or @samp{--summary-file}, and @samp{--summary-count}.
+These each set an option in the @samp{MERCURY_OPTIONS} environment variable,
+ at samp{--trace-count-summary-file} and @samp{--trace-count-summary-max}
+respectively.
+For the documentation of these @samp{mtc} options,
+see the documentation of @samp{MERCURY_OPTIONS} environment variable.
+
+ at sp 1
+
+Trace count files
+can be manipulated with the @samp{mtc_union} and @samp{mtc_diff} tools,
+and they can be analysed by the @samp{mslice} and @samp{mdice} tools.
+They can also be used to help direct a declarative debugging search
 (see @ref{Search Modes}).
 
+ at sp 1
+
+ at node Combining trace counts
+ at subsection Combining trace counts
+
+The @samp{mtc_union} tool can be used
+to combine several trace count files into one trace count file.
+You need to use this when you have
+many trace count files you wish to analyse with @samp{mslice} or @samp{mdice}.
+
+ at samp{mtc_union} is invoked by issuing a command of the form:
+ at sp 1
+ at example
+mtc_union [-v] -o output_file file1 file2 ...
+ at end example
+ at sp 1
+ at samp{file1}, @samp{file2}, etc.
+are the trace count files that should be combined.
+The new trace count file will be written to @samp{output_file}.
+This file will preserve
+the count of the test cases that contributed to its contents,
+even if some of @samp{file1}, @samp{file2}, etc themselves
+were created by @samp{mtc_union}.
+If the @samp{-v} or @samp{--verbose} option is specified
+then a progress message will be displayed
+as each file is read and its contents merged into the union.
+
+The @samp{mtc_diff} tool can be used
+to subtract one trace count file from another.
+
+ at samp{mtc_diff} is invoked by issuing a command of the form:
+ at sp 1
+ at example
+mtc_diff -o output_file file1 file2
+ at end example
+ at sp 1
+ at samp{file1} and @samp{file2} must both be trace counts files.
+The output, written to @samp{output_file}, will contain
+the difference between the trace counts in @samp{file1} and @samp{file2}
+for every event that occurs in @samp{file1}.
+Unlike @samp{mtc_union}, @samp{mtc_diff} does not preserve
+
+ at sp 1
+
 @node Slicing
 @subsection Slicing
 
-Once a slice has been generated it can be viewed in various ways using the
-mslice tool.
+Once a slice has been generated
+it can be viewed in various ways using the mslice tool.
 The output of the mslice tool will look something like the following:
 @sp 1
 @example
@@ -4778,18 +4837,19 @@
 @item @samp{Procedure}:
 This column displays the procedure that the label relates to.
 @item @samp{Path/Port}:
-For labels that generate interface events this column displays          
-the event port and for labels that generate internal events it          
-displays the goal path. (See @ref{Tracing of Mercury programs} for an
-explanation of interface and internal events.)
+For labels that generate interface events this column displays the event port,
+while for labels that generate internal events it displays the goal path.
+(See @ref{Tracing of Mercury programs} for an explanation
+of interface and internal events.)
 @item @samp{File:Line}:
 This column displays the context of the label.
 @item @samp{Count}:
 This column displays how many times the label was executed.
-The number in parentheses for each label row says in how many runs the label
-was executed.
+The number in parentheses for each label row
+says in how many runs the label was executed.
 The number in parentheses in the heading row (after the word "Count")
-indicates how many runs were analysed by the mslice tool.
+indicates how many runs were represented
+in the trace counst file analysed by the mslice tool.
 @end itemize
 
 @sp 1
@@ -4799,13 +4859,14 @@
 mslice [-s sortspec] [-l N] [-m module] file
 @end example
 @sp 1
-where @samp{file} may be a generated trace count file, or a file containing
-a list of generated trace count file names.
- at sp 1
-The @samp{-s} or @samp{--sort} option specifies how the output should be
-sorted.
- at samp{sortspec} should be a string made up of any combination of the letters
- at samp{cCtT}.
+where @samp{file} is a trace count file,
+generated either directly by a program run
+or indirectly by the @samp{mtc_union} or @samp{mtc_diff} tools.
+ at sp 1
+The @samp{-s} or @samp{--sort} option
+specifies how the output should be sorted.
+ at samp{sortspec} should be a string made up of
+any combination of the letters @samp{cCtT}.
 Each letter specifies a column and direction to sort on:
 @itemize @bullet
 @item @samp{c}: Count ascending
@@ -4814,14 +4875,15 @@
 @item @samp{T}: Number of runs descending
 @end itemize
 @sp 1
-For example the option @samp{-s cT} will sort the output table by the
-Count column in ascending order.  If the counts for two or more labels are the
-same, then those labels will be sorted by number of runs in descending order.
+For example the option @samp{-s cT} will sort the output table
+by the Count column in ascending order.
+If the counts for two or more labels are the same,
+then those labels will be sorted by number of runs in descending order.
 @sp 1
 The @samp{-l} or @samp{--limit} option limits the output to @samp{N} lines.
 @sp 1
-The @samp{-m} or @samp{--module} option limits the output to labels only
-from the given module.
+The @samp{-m} or @samp{--module} option limits the output
+to labels only from the given module.
 @sp 1
 
 @node Dicing
@@ -4830,11 +4892,13 @@
 A dice is a comparison between passing and failing runs of a program.
 @sp 1
 Dice are created using the @samp{mdice} tool.
-To use the @samp{mdice} tool one must first generate a set of trace count
-files for passing runs and a set of trace count files for failing runs
+To use the @samp{mdice} tool,
+one must first generate a set of trace count files for passing runs
+and a set of trace count files for failing runs
 using the @samp{mtc} tool (@ref{Generating trace counts}).
-Once this has been done, the @samp{mdice}
-can be used to display a table of statistics
+Once this has been done,
+and the union of each set computed using @samp{mtc_union},
+ at samp{mdice} can be used to display a table of statistics
 that compares the passing runs to the failing runs.
 @sp 1
 Here is an example of the output of the @samp{mdice} tool:
@@ -4858,28 +4922,28 @@
 @item @samp{Procedure}:
 This column displays the procedure the label relates to.
 @item @samp{Path/Port}:
-For labels that generate interface events this column displays          
-the event port and for labels that generate internal events it          
-displays the goal path. (See @ref{Tracing of Mercury programs} for an
-explanation of interface and internal events.)
+For labels that generate interface events this column displays the event port,
+while for labels that generate internal events it displays the goal path.
+(See @ref{Tracing of Mercury programs} for an explanation
+of interface and internal events.)
 @item @samp{File:Line}:
 This column displays the context of the label.
 @item @samp{Pass (total passing test runs)}:
-This columns displays the total number of times the label was executed in all
-the passing test runs.
-This is followed by a number in parentheses which indicates the number of test
-runs the label was executed in.
-The heading of this column also has a number in
-parentheses which is the total number of passing test cases.
+This columns displays the total number of times
+the label was executed in all the passing test runs.
+This is followed by a number in parentheses
+which indicates the number of test runs the label was executed in.
+The heading of this column also has a number in parentheses
+which is the total number of passing test cases.
 @item @samp{Fail}:
-This column displays the number of times the goal was executed in the failing
-test run(s).
+This column displays the number of times
+the goal was executed in the failing test run(s).
 @item @samp{Suspicion}:
-This columns displays a number between 0 and 1 which gives an indication of how
-likely a particular goal is to contain a bug. 
-The suspicion is calculated as Suspicion = F / (P + F) where F is the number of
-times the goal was executed in failing runs and P is the number of times
-the goal was executed in passing runs.
+This columns displays a number between 0 and 1
+which gives an indication of how likely a particular goal is to contain a bug.
+The suspicion is calculated as Suspicion = F / (P + F)
+where F is the number of times the goal was executed in failing runs
+and P is the number of times the goal was executed in passing runs.
 @end itemize
 @sp 1
 The @samp{mdice} tool is invoked with a command of the form:
@@ -4887,18 +4951,19 @@
 @example
 mdice [-s sortspec] [-l N] [-m module] passfile failfile
 @end example
- at samp{passfile} is either a generated trace count file for a passing run,
-or a file containing a list of generated trace count filenames for passing
-runs.
- at samp{failfile} is either a generated trace count file for a failing run,
-or a file containing a list of generated trace count filenames for failing
-runs.
- at sp 1
-The table can be sorted on the Pass, Fail or Suspicion columns, or a
-combination of these.  This can be done with the @samp{-s} or @samp{--sort}
-option.  The argument of this option is a string made up of any combination of
-the letters @samp{pPfFsS}.  The letters in the string indicate how the table
-should be sorted:
+ at samp{passfile} is a trace count file,
+generated either directly by a passing program run
+or as the union of the trace count files of passing program runs.
+ at samp{failfile} is a trace count file,
+generated either directly by a failing program run
+or as the union of the trace count files of failing program runs.
+ at sp 1
+The table can be sorted on the Pass, Fail or Suspicion columns,
+or a combination of these.
+This can be done with the @samp{-s} or @samp{--sort} option.
+The argument of this option is a string
+made up of any combination of the letters @samp{pPfFsS}.
+The letters in the string indicate how the table should be sorted:
 @sp 1
 @itemize @bullet
 @item @samp{p}: Pass ascending
@@ -4909,39 +4974,60 @@
 @item @samp{S}: Suspicion descending
 @end itemize
 @sp 1
-For example the string "SF" means sort the table by suspicion in descending
-order, and if any two suspicions are the same, then by number of executions in
-the failing run(s), also in descending order.
- at sp 1
-The option @samp{-l} or @samp{--limit} can be used to limit the number of lines
-displayed.
- at sp 1
-The @samp{-m} or @samp{--module} option limits the output to the given module
-and any submodules.
+For example the string "SF" means
+sort the table by suspicion in descending order,
+and if any two suspicions are the same,
+then by number of executions in the failing run(s), also in descending order.
+ at sp 1
+The option @samp{-l} or @samp{--limit}
+can be used to limit the number of lines displayed.
+ at sp 1
+The @samp{-m} or @samp{--module} option
+limits the output to the given module and any submodules.
+the count of the test cases that contributed to its contents in any useful way.
 
 @sp 1
 
- at node Combining trace counts
- at subsection Combining trace counts
-
-The @samp{mtc_union} tool can be used to combine several trace count files
-into one trace count file.
-This is useful when you have many trace count files you wish to analyse with
- at samp{mslice} or @samp{mdice}.
-It avoids the overhead of reading all the files
-each time @samp{mslice} or @samp{mdice} is invoked.
-
- at samp{mtc_union} is invoked by issuing a command of the form:
+ at node Coverage testing
+ at subsection Coverage testing
+
+Coverage testing is the process of finding out
+which parts of the code of a program
+are not executed during any test case,
+so that new test cases can be designed specifically to exercise those parts.
+ at sp 1
+The first step in coverage testing a Mercury program
+is compiling that program with execution tracing enabled,
+either by using the @samp{--trace deep} option
+or by compiling the program in a debugging grade.
+The second step is to execute that program on all its test cases
+with coverage testing enabled.
+This can be done either by running the program with @samp{mtc --coverage-test},
+or by including one of the corresponding options
+(@samp{--coverage-test} or @samp{--coverage-test-if-exec=@var{programname}})
+in the value of the @samp{MERCURY_OPTIONS} environment variable.
+These runs generate a set of trace counts files
+that can be given to the Mercury test coverage tool, the @samp{mcov} program.
+ at sp 1
+The @samp{mcov} tool is invoked with a command of the form:
 @sp 1
 @example
-mtc_union [-v] -o output_file file1 file2 ...
+mcov [-d] [-v] [-o output_file] tracecountfile1 ...
 @end example
+The arguments consist of one or more trace count files.
+The output will normally be a list of all the procedures in the program
+that were not executed in any of the runs
+that generated these trace count files.
+The output will go to standard output
+unless this is overridden by the @samp{-o} or @samp{--output-file} option.
+ at sp 1
+If the @samp{-d} or @samp{--detailed} option is specified,
+then the the output will list all the @emph{events} in the program
+that were not executed in any of these runs.
+This option can thus show the unexecuted parts of the executed procedures.
 @sp 1
- at samp{file1}, @samp{file2}, etc. are the trace count files that should be
-combined.
-The new trace count file will be written to @samp{output_file}.
-If the @samp{-v} or @samp{--verbose} option is specified then a progress
-message will be displayed as the files are merged.
+If the @samp{-v} or @samp{--verbose} option is specified,
+then a progress message will be displayed as each file is read.
 
 @c ----------------------------------------------------------------------------
 
@@ -8700,6 +8786,97 @@
 for the lowest value of @var{N} (up to 99)
 which doesn't overwrite an existing file.
 
+ at sp 1
+ at item --trace-count
+ at findex --trace-count
+When the program terminates, generate a trace counts file
+listing all the debugger events the program executed,
+if the program actually executed any debugger events.
+If MERCURY_OPTIONS includes
+the --trace-count-output-file=@var{filename} option,
+then the trace counts are put into the file @var{filename}.
+If MERCURY_OPTIONS includes
+the --trace-count-summary-file=@var{basename} option,
+then the trace counts are put
+either in the file @var{basename} (if it does not exist),
+or in @var{basename.N} for the lowest value of the integer @var{N}
+which doesn't overwrite an existing file.
+(There is a limit on the value of @var{N};
+see the option --trace-count-summary-max below.)
+If neither option is specified,
+then the output will be written to a file
+with the prefix @samp{.mercury_trace_counts} and a unique suffix.
+Specifying both options is an error.
+
+ at sp 1
+ at item --coverage-test
+ at findex --coverage-test
+Act as the --trace-count option, except
+include @emph{all} debugger events in the output,
+even the ones that were not executed.
+
+ at sp 1
+ at item --trace-count-if-exec=@var{prog}
+ at findex --trace-count-if-exec=@var{prog}
+Act as the --trace-count option,
+but only if the executable is named @var{prog}.
+This is to allow
+the collection of trace count information from only one Mercury program
+even if several Mercury programs
+are executed with the same setting of MERCURY_OPTIONS.
+
+ at sp 1
+ at item --coverage-test-if-exec=@var{prog}
+ at findex --coverage-test-if-exec=@var{prog}
+Act as the --coverage-test option,
+but only if the executable is named @var{prog}.
+This is to allow
+the collection of coverage test information from only one Mercury program
+even if several Mercury programs
+are executed with the same setting of MERCURY_OPTIONS.
+
+ at sp 1
+ at item --trace-count-output-file=@var{filename}
+ at findex --trace-count-output-file=@var{filename}
+Documented alongside the --trace-count option.
+
+ at sp 1
+ at item --trace-count-summary-file=@var{basename}
+ at findex --trace-count-summary-file=@var{basename}
+Documented alongside the --trace-count option.
+
+ at sp 1
+ at item --trace-count-summary-max=@var{N}
+ at findex --trace-count-summary-max=@var{N}
+If MERCURY_OPTIONS includes both
+the --trace-count option (or one of the other options that imply --trace-count)
+and the --trace-count-summary-file=@var{basename} option,
+then the generated program will put the generated trace counts
+either in @var{basename} (if it does not exist),
+or in @var{basename.N} for the lowest value of the integer @var{N}
+which doesn't overwrite an existing file.
+The --trace-count-summary-max option
+specifies the maximum value of this @var{N}.
+When this maximum is reached,
+the program will invoke the @samp{mtc_union} program
+to summarize @var{basename}, @var{basename.1}, ... @var{basename.N}
+into a single file @var{basename}, and delete the rest.
+By imposing a limit on the total number
+(and hence indirectly on the total size) of these trace count files,
+this mechanism allows the gathering of trace count information
+from a large number of program runs.
+The default maximum value of @var{N} is 20.
+
+ at c @sp 1
+ at c @item --trace-count-summary-cmd=@var{cmd}
+ at c @findex --trace-count-summary-cmd=@var{cmd}
+ at c This option specifies the command to use instead of mtc_union
+ at c for computing trace counts summaries, as shown for the above option.
+ at c This documentation is commented out
+ at c because the option is for implementors only.
+ at c The intended use is to override the installed version of mtc_union
+ at c with the version in a specific workspace, which may be more recent.
+
 @end table
 
 @sp 1
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
Index: mdbcomp/slice_and_dice.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/slice_and_dice.m,v
retrieving revision 1.9
diff -u -b -r1.9 slice_and_dice.m
--- mdbcomp/slice_and_dice.m	22 Sep 2006 03:50:45 -0000	1.9
+++ mdbcomp/slice_and_dice.m	22 Sep 2006 05:00:40 -0000
@@ -50,25 +50,24 @@
                                     % executed in.
             ).
 
-    % read_slice(Source, File, MaybeSlice, !IO):
+    % read_slice(File, MaybeSlice, !IO):
     %
-    % Read the slice(s) from Source and File.
+    % Read the slices from File.
     %
-:- pred read_slice(slice_source::in, string::in,
-    maybe_error(slice)::out, io::di, io::uo) is det.
+:- pred read_slice(string::in, maybe_error(slice)::out, io::di, io::uo) is det.
 
     % read_slice_to_string(File, SortStr, N, Module, SliceStr, Problem, !IO):
     %
-    % Read the slice(s) from try_single_first and File, and convert it
-    % to a string suitable for displaying on the screen, sorting it first
-    % using SortStr. SortStr can be any combination of the letters "cCtT"
-    % and indicates how the dice is to be sorted. See the documentation
-    % for the `mslice' tool in the user guide for an explanation of
-    % the sort string. Take only the top N lines of the sorted list.
-    %
-    % If Module is not the empty string then only labels from the named
-    % module will be included in the dice string, otherwise all modules
-    % will be included.
+    % Read the slice from File, and convert it to a string suitable for
+    % displaying on the screen, sorting it first using SortStr. SortStr
+    % can be any combination of the letters "cCtT" and indicates how the slice
+    % is to be sorted. See the documentation for the `mslice' tool in the
+    % user guide for an explanation of the sort string. Take only the top N
+    % lines of the sorted list.
+    %
+    % If Module is not the empty string then only labels from the named module
+    % will be included in the dice string, otherwise all modules will be
+    % included.
     %
     % If there was a problem reading the trace counts then Problem will
     % contain a string describing the problem encountered and SliceStr
@@ -112,29 +111,21 @@
                                 % was executed in.
             ).
 
-    % read_dice(PassSource, PassFile, FailSource, FailFile, MaybeDice, !IO):
+    % read_dice(PassFile, FailFile, MaybeDice, !IO):
     %
-    % Read the slice(s) from PassSource and PassFile, interpreting them as
-    % passing slices; read the slice(s) from FailSource and FailFile,
-    % interpreting them as failing slices; then produce the dice you get
-    % from them.
+    % Read the slice from PassFile, interpreting it as (a union of) passing
+    % slices; read the slices from FailFile, interpreting it as (a union of)
+    % failing slices; then produce the dice you get from them.
     %
-:- pred read_dice(slice_source::in, string::in, slice_source::in, string::in,
-    maybe_error(dice)::out, io::di, io::uo) is det.
-
-    % Same as read_dice/7, but with PassSource and FailSource both
-    % try_single_first.
-    %
-:- pred read_dice_try_single_first(string::in, string::in,
-    maybe_error(dice)::out, io::di, io::uo) is det.
+:- pred read_dice(string::in, string::in, maybe_error(dice)::out,
+    io::di, io::uo) is det.
 
     % read_dice_to_string(PassFile, FailFile, SortStr, N, Module, DiceStr,
     %   Problem, !IO):
     %
-    % Read the slice(s) from try_single_first and PassFile, interpreting them
-    % as passing slices; read the slice(s) from try_single_first and FailFile,
-    % interpreting them as failing slices; then produce the dice you get
-    % from them.
+    % Read the slice from PassFile, interpreting it as (a union of) passing
+    % slices; read the slices from FailFile, interpreting it as (a union of)
+    % failing slices; then produce the dice you get from them.
     %
     % Then convert the dice to a string suitable for displaying on the screen,
     % sorting it first using SortStr. SortStr can be any combination of the
@@ -143,9 +134,9 @@
     % for an explanation of the sort string. Take only the top N lines
     % of the sorted list.
     %
-    % If Module is not the empty string then only labels from the named
-    % module will be included in the dice string, otherwise all modules
-    % will be included.
+    % If Module is not the empty string then only labels from the named module
+    % will be included in the dice string, otherwise all modules will be
+    % included.
     %
     % If there was a problem reading the trace counts then Problem will
     % contain a string describing the problem encountered and DiceStr
@@ -200,8 +191,8 @@
 % The mechanism for reading in slices. The structure is similar to the
 % mechanism for reading in dices below.
 
-read_slice(Source, File, Result, !IO) :-
-    read_trace_counts_source(no, Source, File, ReadResult, !IO),
+read_slice(File, Result, !IO) :-
+    read_trace_counts_source(File, ReadResult, !IO),
     (
         ReadResult = list_ok(FileType, TraceCounts),
         slice_merge_trace_counts(TraceCounts, map.init, SliceProcMap),
@@ -268,17 +259,19 @@
 % The mechanism for reading in dices. The structure is similar to the
 % mechanism for reading in slices above.
 
-read_dice(PassSource, PassFile, FailSource, FailFile, Result, !IO) :-
-    read_trace_counts_source(no, PassSource, PassFile, ReadPassResult, !IO),
+:- pragma foreign_export("C", read_dice(in, in, out, di, uo),
+    "MR_MDB_read_dice").
+
+read_dice(PassFile, FailFile, Result, !IO) :-
+    read_trace_counts_source(PassFile, ReadPassResult, !IO),
     (
         ReadPassResult = list_ok(PassFileType, PassTraceCounts),
-        read_trace_counts_source(no, FailSource, FailFile, ReadFailResult,
-            !IO),
+        read_trace_counts_source(FailFile, ReadFailResult, !IO),
         (
             ReadFailResult = list_ok(FailFileType, FailTraceCounts),
-            dice_merge_trace_counts(pass, PassTraceCounts, map.init,
+            dice_merge_trace_counts(pass_slice, PassTraceCounts, map.init,
                 PassDiceProcMap),
-            dice_merge_trace_counts(fail, FailTraceCounts,
+            dice_merge_trace_counts(fail_slice, FailTraceCounts,
                 PassDiceProcMap, DiceProcMap),
             TotalPassTests = num_tests_for_file_type(PassFileType),
             TotalFailTests = num_tests_for_file_type(FailFileType),
@@ -293,13 +286,6 @@
         Result = error(Problem)
     ).
 
-:- pragma foreign_export("C", read_dice_try_single_first(in, in, out, di, uo),
-    "MR_MDB_read_dice_try_single_first").
-
-read_dice_try_single_first(PassFile, FailFile, Result, !IO) :-
-    read_dice(try_single_first, PassFile, try_single_first, FailFile, Result,
-        !IO).
-
 :- pred maybe_dice_error_to_problem_string(maybe_error(dice)::in, string::out)
 	is det.
 
@@ -319,8 +305,8 @@
 	error("det_maybe_dice_error_to_dice: result is error").
 
 :- type trace_counts_kind
-    --->    pass
-    ;       fail.
+    --->    pass_slice
+    ;       fail_slice.
 
     % Merge the passing or failing trace_counts into the given dice.
     %
@@ -360,11 +346,11 @@
     ;
         LineNoAndCount = line_no_and_count(LineNumber, ExecCount, NumTests),
         (
-            Kind = pass,
+            Kind = pass_slice,
             InitCount = dice_exec_count(FileName, LineNumber,
                 ExecCount, NumTests, 0, 0)
         ;
-            Kind = fail,
+            Kind = fail_slice,
             InitCount = dice_exec_count(FileName, LineNumber, 0, 0,
                 ExecCount, NumTests)
         ),
@@ -374,13 +360,13 @@
 :- pred dice_add_trace_count(trace_counts_kind::in, line_no_and_count::in,
     dice_exec_count::in, dice_exec_count::out) is det.
 
-dice_add_trace_count(pass, LineNoAndCount, ExecCounts0, ExecCounts) :-
+dice_add_trace_count(pass_slice, LineNoAndCount, ExecCounts0, ExecCounts) :-
     LineNoAndCount = line_no_and_count(_LineNumber, ExecCount, NumTests),
     ExecCounts0 = dice_exec_count(FileName, LineNumber,
         PassExec, PassTests, FailExec, FailTests),
     ExecCounts = dice_exec_count(FileName, LineNumber,
         PassExec + ExecCount, PassTests + NumTests, FailExec, FailTests).
-dice_add_trace_count(fail, LineNoAndCount, ExecCounts0, ExecCounts) :-
+dice_add_trace_count(fail_slice, LineNoAndCount, ExecCounts0, ExecCounts) :-
     LineNoAndCount = line_no_and_count(_LineNumber, ExecCount, NumTests),
     ExecCounts0 = dice_exec_count(FileName, LineNumber,
         PassExec, PassTests, FailExec, FailTests),
@@ -398,7 +384,7 @@
 
 read_slice_to_string(File, SortStr0, N, Module, SliceStr, Problem, !IO) :-
     ( slice_sort_string_is_valid(SortStr0) ->
-        read_slice(try_single_first, File, ReadSliceResult, !IO),
+        read_slice(File, ReadSliceResult, !IO),
         (
             ReadSliceResult = ok(Slice),
             Slice = slice(TotalTests, SliceProcMap),
@@ -581,8 +567,7 @@
 read_dice_to_string(PassFile, FailFile, SortStr, N, Module, DiceStr, Problem,
         !IO) :-
     ( dice_sort_string_is_valid(SortStr) ->
-        read_dice(try_single_first, PassFile, try_single_first, FailFile,
-            ReadDiceResult, !IO),
+        read_dice(PassFile, FailFile, ReadDiceResult, !IO),
         (
             ReadDiceResult = ok(Dice),
             Dice = dice(TotalPassTests, TotalFailTests, DiceProcMap),
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.13
diff -u -b -r1.13 trace_counts.m
--- mdbcomp/trace_counts.m	22 Sep 2006 03:50:45 -0000	1.13
+++ mdbcomp/trace_counts.m	22 Sep 2006 04:59:33 -0000
@@ -126,37 +126,15 @@
 :- pred read_trace_counts_list(bool::in, string::in,
     read_trace_counts_list_result::out, io::di, io::uo) is det.
 
-:- type slice_source
-    --->    file_list
-    ;       single_file
-    ;       try_single_first.
-
-    % read_trace_counts_source(ShowProgress, Source, FileName, Result, !IO):
-    %
-    % Read in trace counts stored in one or more trace count files.
-    %
-    % If Source is file_list, then FileName should contain a list of filenames,
-    % and read_trace_counts_source will read in the trace counts from each
-    % of those files.
-    %
-    % If Source is single_file, then FileName should itself be a file
-    % containing trace counts data.
-    %
-    % If Source is try_single_first, then read_trace_counts_source will
-    % check to see if FileName contains trace counts data. If yes, it will
-    % get trace counts from there. If not, read_trace_counts_source will
-    % interpret FileName as a file that itself contains filenames, and
-    % will treat it as with Source=file_list.
+    % read_trace_counts_source(FileName, Result, !IO):
     %
-    % If the source is a list of files and ShowProgress is yes then
-    % the name of each file read will be printed to the current output
-    % stream just before it is read.
+    % Read in trace counts stored in one a given trace count file.
     %
-:- pred read_trace_counts_source(bool::in, slice_source::in, string::in,
+:- pred read_trace_counts_source(string::in,
     read_trace_counts_list_result::out, io::di, io::uo) is det.
 
-    % read_and_union_trace_counts(ShowProgress, Source, FileNames,
-    %   NumTests, TestKinds, TraceCounts, MaybeError, !IO):
+    % read_and_union_trace_counts(ShowProgress, FileNames, NumTests, TestKinds,
+    %   TraceCounts, MaybeError, !IO):
     %
     % Invoke read_trace_counts_source for each of the supplied filenames, and
     % union the resulting trace counts. If there is a problem with reading in
@@ -165,9 +143,13 @@
     % the union of the trace counts and NumTests will contain the number of
     % tests the trace counts come from.
     %
-:- pred read_and_union_trace_counts(bool::in, slice_source::in,
-    list(string)::in, int::out, set(trace_count_file_type)::out,
-    trace_counts::out, maybe(string)::out, io::di, io::uo) is det.
+    % If the source is a list of files and ShowProgress is yes then
+    % the name of each file read will be printed to the current output
+    % stream just before it is read.
+    %
+:- pred read_and_union_trace_counts(bool::in, list(string)::in, int::out,
+    set(trace_count_file_type)::out, trace_counts::out, maybe(string)::out,
+    io::di, io::uo) is det.
 
     % write_trace_counts_to_file(FileType, TraceCounts, FileName, Result, !IO):
     %
@@ -305,19 +287,7 @@
 
 %-----------------------------------------------------------------------------%
 
-read_trace_counts_source(ShowProgress, Source, FileName, Result, !IO) :-
-    (
-        Source = file_list,
-        read_trace_counts_list(ShowProgress, FileName, Result, !IO)
-    ;
-        Source = single_file,
-        (
-            ShowProgress = yes,
-            io.write_string(FileName, !IO),
-            io.nl(!IO)
-        ;
-            ShowProgress = no
-        ),
+read_trace_counts_source(FileName, Result, !IO) :-
         read_trace_counts(FileName, ReadTCResult, !IO),
         (
             ReadTCResult = ok(FileType, TraceCount),
@@ -340,19 +310,6 @@
             ReadTCResult = error_message(ErrMsg),
             Result = list_error_message("Error reading trace counts " ++
                 "from file `" ++ FileName ++ "': " ++ ErrMsg)
-        )
-    ;
-        Source = try_single_first,
-        read_trace_counts_source(ShowProgress, single_file, FileName,
-            TryResult, !IO),
-        (
-            TryResult = list_ok(_, _),
-            Result = TryResult
-        ;
-            TryResult = list_error_message(_),
-            read_trace_counts_source(ShowProgress, file_list, FileName,
-                Result, !IO)
-        )
     ).
 
 read_trace_counts_list(ShowProgress, FileName, Result, !IO) :-
@@ -776,9 +733,9 @@
 
 %-----------------------------------------------------------------------------%
 
-read_and_union_trace_counts(ShowProgress, SliceSource, Files,
-        NumTests, TestKinds, TraceCounts, MaybeError, !IO) :-
-    read_and_union_trace_counts_2(ShowProgress, SliceSource, Files,
+read_and_union_trace_counts(ShowProgress, Files, NumTests, TestKinds,
+        TraceCounts, MaybeError, !IO) :-
+    read_and_union_trace_counts_2(ShowProgress, Files,
         union_file(0, []), FileType, map.init, TraceCounts, MaybeError, !IO),
     (
         FileType = union_file(NumTests, TestKindList),
@@ -791,22 +748,28 @@
         error("read_and_union_trace_counts: diff_file")
     ).
 
-:- pred read_and_union_trace_counts_2(bool::in, slice_source::in,
+:- pred read_and_union_trace_counts_2(bool::in,
     list(string)::in, trace_count_file_type::in, trace_count_file_type::out,
     trace_counts::in, trace_counts::out, maybe(string)::out,
     io::di, io::uo) is det.
 
-read_and_union_trace_counts_2(_, _, [], !FileType, !TraceCounts,
-        no, !IO).
-read_and_union_trace_counts_2(ShowProgress, SliceSource, [File | Files],
+read_and_union_trace_counts_2(_, [], !FileType, !TraceCounts, no, !IO).
+read_and_union_trace_counts_2(ShowProgress, [FileName | FileNames],
         !FileType, !TraceCounts, MaybeError, !IO) :-
-    read_trace_counts_source(ShowProgress, SliceSource, File, TCResult, !IO),
+    (
+        ShowProgress = yes,
+        io.write_string(FileName, !IO),
+        io.nl(!IO)
+    ;
+        ShowProgress = no
+    ),
+    read_trace_counts_source(FileName, TCResult, !IO),
     (
         TCResult = list_ok(FileType, NewTraceCounts),
         summarize_trace_counts_list([!.TraceCounts, NewTraceCounts],
             !:TraceCounts),
         !:FileType = sum_trace_count_file_type(!.FileType, FileType),
-        read_and_union_trace_counts_2(ShowProgress, SliceSource, Files,
+        read_and_union_trace_counts_2(ShowProgress, FileNames,
             !FileType, !TraceCounts, MaybeError, !IO)
     ;
         TCResult = list_error_message(Message),
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
Index: slice/mcov.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/mcov.m,v
retrieving revision 1.1
diff -u -b -r1.1 mcov.m
--- slice/mcov.m	22 Sep 2006 03:50:47 -0000	1.1
+++ slice/mcov.m	24 Sep 2006 06:03:25 -0000
@@ -53,8 +53,8 @@
         (
             Args = [_ | _],
             lookup_bool_option(OptionTable, verbose, Verbose),
-            read_and_union_trace_counts(Verbose, try_single_first, Args,
-                _NumTests, FileTypes, TraceCounts, MaybeReadError, !IO),
+            read_and_union_trace_counts(Verbose, Args, _NumTests, FileTypes,
+                TraceCounts, MaybeReadError, !IO),
             stderr_stream(StdErr, !IO),
             (
                 MaybeReadError = yes(ReadErrorMsg),
@@ -325,14 +325,13 @@
 
 usage(!IO) :-
     io.write_strings([
-        "Usage: mct [-d] [-v] [-o output_file] file1 file2 ...\n",
+        "Usage: mcov [-d] [-v] [-o output_file] file1 file2 ...\n",
         "The -d or --detailed option causes the printing of a report for\n",
         "each label that has not been executed, even if some other code\n",
         "has been executed in the same procedure.\n",
         "The -v or --verbose option causes each trace count file name\n",
         "to be printed as it is added to the union.\n",
-        "file1, file2, etc can be trace count files or they can be files\n",
-        "that contains lists of the names of other trace count files.\n"],
+        "file1, file2, etc should be trace count files.\n"],
         !IO).
 
 %-----------------------------------------------------------------------------%
@@ -357,7 +356,7 @@
 short_option('v',               verbose).
 
 long_option("detailed",         detailed).
-long_option("out",              output_filename).
+long_option("output-file",      output_filename).
 long_option("verbose",          verbose).
 
 %-----------------------------------------------------------------------------%
Index: slice/mtc_diff.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/mtc_diff.m,v
retrieving revision 1.1
diff -u -b -r1.1 mtc_diff.m
--- slice/mtc_diff.m	22 Sep 2006 03:50:48 -0000	1.1
+++ slice/mtc_diff.m	24 Sep 2006 05:48:59 -0000
@@ -50,8 +50,7 @@
             OutputFile \= ""
         ->
             stderr_stream(StdErr, !IO),
-            read_trace_counts_source(no, try_single_first, Arg1,
-                MaybeTraceCounts1, !IO),
+            read_trace_counts_source(Arg1, MaybeTraceCounts1, !IO),
             (
                 MaybeTraceCounts1 = list_ok(_, _)
             ;
@@ -59,8 +58,7 @@
                 io.write_string(StdErr, Msg1, !IO),
                 io.nl(StdErr, !IO)
             ),
-            read_trace_counts_source(no, try_single_first, Arg2,
-                MaybeTraceCounts2, !IO),
+            read_trace_counts_source(Arg2, MaybeTraceCounts2, !IO),
             (
                 MaybeTraceCounts2 = list_ok(_, _)
             ;
@@ -100,10 +98,8 @@
 :- pred usage(io::di, io::uo) is det.
 
 usage(!IO) :-
-    io.write_strings([
-        "Usage: mtc_diff -o outputfile file1 file2\n",
-        "file1, file2, etc can be trace count files or they can be files\n",
-        "that contains lists of the names of other trace count files.\n"],
+    io.write_string(
+        "Usage: mtc_diff -o outputfile tracecountfile1 tracecountfile2\n",
         !IO).
 
 %-----------------------------------------------------------------------------%
Index: slice/mtc_union.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/mtc_union.m,v
retrieving revision 1.3
diff -u -b -r1.3 mtc_union.m
--- slice/mtc_union.m	22 Sep 2006 03:50:48 -0000	1.3
+++ slice/mtc_union.m	24 Sep 2006 05:49:19 -0000
@@ -51,8 +51,8 @@
             OutputFile \= ""
         ->
             lookup_bool_option(OptionTable, verbose, Verbose),
-            read_and_union_trace_counts(Verbose, try_single_first, Args,
-                NumTests, Kinds, TraceCounts, MaybeReadError, !IO),
+            read_and_union_trace_counts(Verbose, Args, NumTests, Kinds,
+                TraceCounts, MaybeReadError, !IO),
             stderr_stream(StdErr, !IO),
             (
                 MaybeReadError = yes(ReadErrorMsg),
@@ -89,8 +89,7 @@
         "Usage: mtc_union [-v] -o output_file file1 file2 ...\n",
         "The -v or --verbose option causes each trace count file name\n",
         "to be printed as it is added to the union.\n",
-        "file1, file2, etc can be trace count files or they can be files\n",
-        "that contains lists of the names of other trace count files.\n"],
+        "file1, file2, etc should be trace count files.\n"],
         !IO).
 
 %-----------------------------------------------------------------------------%
cvs diff: Diffing tests
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.47
diff -u -b -r1.47 Mmake.common
--- tests/Mmake.common	25 Jan 2006 07:03:44 -0000	1.47
+++ tests/Mmake.common	24 Sep 2006 03:57:46 -0000
@@ -275,7 +275,10 @@
 THIS_DIR_TESTS_TO_RUN := $(SPECIFIED_TESTS)
 else
 ifdef FAILED_TESTS_ONLY
-THIS_DIR_TESTS_TO_RUN := $(shell FAILED_TESTS)
+# FAILED_TESTS contains the names of failed tests from subdirectories
+# as well as this directory. We want to run the failed tests from this
+# directory only.
+THIS_DIR_TESTS_TO_RUN := $(shell egrep -v / FAILED_TESTS)
 else
 ifdef TESTS_TO_RUN
 THIS_DIR_TESTS_TO_RUN := $(shell echo $(patsubst $(THIS_DIR)/%,%,\
Index: tests/run_one_test
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/run_one_test,v
retrieving revision 1.2
diff -u -b -r1.2 run_one_test
--- tests/run_one_test	29 Apr 2005 01:03:24 -0000	1.2
+++ tests/run_one_test	24 Sep 2006 00:47:39 -0000
@@ -3,6 +3,8 @@
 
 set -x
 
+max_num_trace_counts=50
+
 exitstatus=0
 echo RUNNING TEST $this_dir/$test_full $params_msg | tee $test_full.log
 echo "MERCURY_OPTIONS=$MERCURY_OPTIONS"
@@ -48,32 +50,36 @@
         echo $this_dir/$test_full $params_msg \
             >> $tests_dir/FAILED_TESTS_SUMMARY
         tcdir=FAILED_TC_DIR
-        tcfile=FAILED_TC_FILES
         exitstatus=1
     else
         rm -f $test_full.log $test.out* $test.*res*
         mmake $test.realclean > /dev/null 2>&1
         echo PASSED TEST $this_dir/$test_full $params_msg
         tcdir=PASSED_TC_DIR
-        tcfile=PASSED_TC_FILES
     fi
     case "$trace_count" in
         true)
-            mkdir -p $tests_dir/$tcdir
-            testname=`echo $this_dir/$test_full | tr '[/]' '[:]'`
+            n=`cat $tests_dir/$tcdir/NEXT_NUMBER`
             for counts_file in .mercury_trace_counts.*
             do
                 if test -s "$counts_file"
                 then
-                    progpidname=`echo "$counts_file" | \
-                        sed -e 's/.mercury_trace_counts.//'`
-                    name="TEST_${testname}_PROG_${progpidname}"
-                    mv $counts_file $tests_dir/$tcdir/$name
-                    /bin/rm -f $tests_dir/$tcdir/$name.gz
-                    gzip $tests_dir/$tcdir/$name
-                    echo $tcdir/$name >> $tests_dir/$tcfile
+                    mv "$counts_file" "$tests_dir/$tcdir/trace_counts.$n"
+                    n=`expr $n + 1`
                 fi
             done
+            if test "$n" -gt "$max_num_trace_counts"
+            then
+                ${SLICE_DIR}mtc_union -o $tests_dir/$tcdir/tmp_summary \
+                    $tests_dir/$tcdir/trace_counts.*
+                /bin/rm -f $tests_dir/$tcdir/trace_counts.*
+                mv $tests_dir/$tcdir/tmp_summary \
+                    $tests_dir/$tcdir/trace_counts.0
+
+                echo 1 > $tests_dir/$tcdir/NEXT_NUMBER
+            else
+                echo $n > $tests_dir/$tcdir/NEXT_NUMBER
+            fi
             ;;
     esac
 fi
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.125
diff -u -b -r1.125 Mmakefile
--- tests/debugger/Mmakefile	22 Aug 2006 02:33:48 -0000	1.125
+++ tests/debugger/Mmakefile	24 Sep 2006 03:35:36 -0000
@@ -317,12 +317,16 @@
 	MERCURY_OPTIONS=--trace-count ./dice 10 11 100 && \
 	mv .mercury_trace_counts.*dice.* dice.pass3
 
+dice.passes: dice.pass1 dice.pass2 dice.pass3
+	MERCURY_OPTIONS= \
+	$(SLICE_DIR)mtc_union -o dice.passes dice.pass1 dice.pass2 dice.pass3
+
 dice.fail: dice
 	/bin/rm -f .mercury_trace_counts.*dice.*
 	MERCURY_OPTIONS=--trace-count ./dice 4 1 2 3 && \
 	mv .mercury_trace_counts.*dice.* dice.fail
 
-dice.out: dice dice.inp dice.pass1 dice.pass2 dice.pass3 dice.fail
+dice.out: dice dice.inp dice.passes dice.fail
 	$(MDB_STD) ./dice 4 1 2 3 < dice.inp > dice.out 2>&1
 
 # We need to pipe the output through sed to avoid hard-coding dependencies on
Index: tests/debugger/dice.passes
===================================================================
RCS file: tests/debugger/dice.passes
diff -N tests/debugger/dice.passes
--- tests/debugger/dice.passes	10 Feb 2005 04:10:32 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-dice.pass1
-dice.pass2
-dice.pass3
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.185
diff -u -b -r1.185 bootcheck
--- tools/bootcheck	22 Sep 2006 03:50:48 -0000	1.185
+++ tools/bootcheck	24 Sep 2006 03:45:47 -0000
@@ -543,7 +543,7 @@
 
 if $trace_count
 then
-    MERCURY_OPTIONS="$MERCURY_OPTIONS --trace-count"
+    MERCURY_OPTIONS="$MERCURY_OPTIONS --trace-count-if-exec=mercury_compile"
     export MERCURY_OPTIONS
 else
     true
@@ -1566,15 +1566,20 @@
 
         case $failing_tests_only in
             true)
-                test_log_opt="FAILING_TESTS_ONLY"
+                test_log_opt="FAILED_TESTS_ONLY=yes"
                 ;;
         esac
 
         cd $root/${tests_prefix}tests
-        /bin/rm -fr PASSED_TC_DIR PASSED_TC_FILES > /dev/null 2>&1
-        /bin/rm -fr FAILED_TC_DIR FAILED_TC_FILES > /dev/null 2>&1
         > FAILED_TESTS_SUMMARY
 
+        /bin/rm -fr PASSED_TC_DIR FAILED_TC_DIR > /dev/null 2>&1
+        mkdir -p PASSED_TC_DIR FAILED_TC_DIR
+        echo 0 > PASSED_TC_DIR/NEXT_NUMBER
+        echo 0 > FAILED_TC_DIR/NEXT_NUMBER
+        SLICE_DIR="$root/slice/"
+        export SLICE_DIR
+
         if test "$specified_tests_only" != ""
         then
             test_status=0
@@ -1621,6 +1626,16 @@
             mv "$type_stats" "$type_stats".test.$$
         fi
 
+        for tcdir in PASSED_TC_DIR FAILED_TC_DIR
+        do
+            if test "`cat $tcdir/NEXT_NUMBER`" -gt 0
+            then
+                ${SLICE_DIR}slice/mtc_union -o $tcdir/SUMMARY \
+                    $tcdir/trace_counts.*
+                /bin/rm $tcdir/trace_counts.*
+            fi
+        done
+
         cd $root
     fi
 fi
cvs diff: Diffing trace
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.101
diff -u -b -r1.101 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	7 Aug 2006 06:21:32 -0000	1.101
+++ trace/mercury_trace_declarative.c	23 Sep 2006 16:34:28 -0000
@@ -2238,12 +2238,11 @@
     );
 
     MR_TRACE_CALL_MERCURY(
-        MR_MDB_read_dice_try_single_first(
+        MR_MDB_read_dice(
             aligned_pass_trace_counts_file,
             aligned_fail_trace_counts_file,
             &maybe_dice);
-        MR_DD_maybe_dice_error_to_problem_string(maybe_dice, 
-            problem);
+        MR_DD_maybe_dice_error_to_problem_string(maybe_dice, problem);
     );
     if (! MR_streq(*problem, "")) {
         return MR_FALSE;
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list