[m-dev.] diff: Re-enable DD test cases

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Jan 22 11:07:52 AEDT 2000


On 20-Jan-2000, Mark Anthony BROWN <dougl at cs.mu.OZ.AU> wrote:
> tests/Mmake.common:
> 	Report the diff from either the .exp file or the .exp2 file,
> 	whichever diff is smaller.
> 
> Index: Mmake.common
> ===================================================================
> RCS file: /home/mercury1/repository/tests/Mmake.common,v
> retrieving revision 1.16
> diff -u -r1.16 Mmake.common
> --- Mmake.common	1999/10/05 21:54:28	1.16
> +++ Mmake.common	2000/01/07 13:00:51
> @@ -35,12 +35,18 @@
>  # For some test cases, there is more than one valid output.
>  # We try matching the output with the `.exp' file, and if that
>  # doesn't succeed, and there is a `.exp2' file, then we try matching
> -# against that too.
> +# against that too.  If neither succeed, the shorter of the two diffs
> +# is put into the `.res' file.
>  #
>  %.res: %.exp %.out
>  	-rm -f $@
> +	-rm -f $*.res2
>  	diff $(DIFF_OPTS) $*.exp $*.out > $@ || \
> -		{ [ -f $*.exp2 ] && diff $(DIFF_OPTS) $*.exp2 $*.out > $@; }
> +		if [ -f $*.exp2 ]; then	\
> +			diff $(DIFF_OPTS) $*.exp2 $*.out > $*.res2; \
> +			[ `wc -l < $@` -lt `wc -l < $*.res2` ] || \
> +				cp $*.res2 $@; \
> +		fi

That code won't return the appropriate exit status if the second diff fails.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list