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

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu Jan 20 15:59:06 AEDT 2000


Zoltan Somogyi writes:
>
> The Mmakefile should be changed in all relevant directories so that it reports
> the diff from either the .exp file or the .exp2 file, whichever diff is
> smaller, but that is a separate change.
> 

Estimated hours taken: 1

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
 
 #-----------------------------------------------------------------------------#
 
@@ -56,6 +62,7 @@
 
 clean_res:
 	rm -f *.res
+	rm -f *.res2
 
 #
 # The `foo' targets make `foo_local' in the current directory before

-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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