[m-dev.] diff: fix .exp* files for uncaught exception tests

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 16 04:31:21 AEST 2000


Estimated hours taken: 1

tests/Mmake.common:
	Add support for `.exp3' files.

tests/general/string_format_test_2.exp3:
tests/general/string_format_test_3.exp3:
tests/hard_coded/exceptions/test_uncaught_exception.exp3:
	Add new alternative expected outputs for these test cases,
	to match what the MLDS back-end outputs for uncaught exceptions.

Workspace: /home/pgrad/fjh/ws/hg
Index: tests/general/string_format_test_2.exp3
===================================================================
RCS file: string_format_test_2.exp3
diff -N string_format_test_2.exp3
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ string_format_test_2.exp3	Tue May 16 03:55:24 2000
@@ -0,0 +1,2 @@
+Uncaught exception:
+Software Error: string__format: argument list has more elements than format string
Index: tests/general/string_format_test_3.exp3
===================================================================
RCS file: string_format_test_3.exp3
diff -N string_format_test_3.exp3
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ string_format_test_3.exp3	Tue May 16 03:55:38 2000
@@ -0,0 +1,2 @@
+Uncaught exception:
+Software Error: string__format: argument list has fewer elements than format string
Index: tests/hard_coded/exceptions/test_uncaught_exception.exp3
===================================================================
RCS file: test_uncaught_exception.exp3
diff -N test_uncaught_exception.exp3
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ test_uncaught_exception.exp3	Tue May 16 04:21:56 2000
@@ -0,0 +1,2 @@
+Uncaught exception:
+"<exception thrown from main>"
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.20
diff -u -d -r1.20 Mmake.common
--- tests/Mmake.common	2000/02/16 07:30:13	1.20
+++ tests/Mmake.common	2000/05/15 18:25:20
@@ -33,22 +33,31 @@
 #
 # 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.  If neither succeed, the shorter of the two diffs
-# is put into the `.res' file.
+# doesn't succeed, and there is a `.exp2' and/or a `.exp3' file,
+# then we try matching against those too.  If none succeed,
+# the shortest of the diffs is put into the `.res' file.
 #
 %.res: %.exp %.out
-	-rm -f $@
-	-rm -f $*.res2
-	diff $(DIFF_OPTS) $*.exp $*.out > $@ || \
-		{ test -f $*.exp2 && \
-			if diff $(DIFF_OPTS) $*.exp2 $*.out > $*.res2; then \
-				cp $*.res2 $@; \
-			else \
-				{ test `wc -l < $@` -le `wc -l < $*.res2` || \
-					cp $*.res2 $@; } && false; \
-			fi; \
-		}
+	@echo "Comparing $*.out with $*.exp*,"
+	@echo "	results in $@"
+	@-rm -f $@ $*.res[1-3]
+	@{ diff $(DIFF_OPTS) $*.exp $*.out > $*.res1 && \
+		echo "Matched $*.exp" && \
+		cp $*.res1 $@; } || \
+	{ test -f $*.exp2 && \
+		diff $(DIFF_OPTS) $*.exp2 $*.out > $*.res2 && \
+		echo "Matched $*.exp2" && \
+		cp $*.res2 $@; } || \
+	{ test -f $*.exp3 && \
+		diff $(DIFF_OPTS) $*.exp3 $*.out > $*.res3 && \
+		echo "Matched $*.exp3" && \
+		cp $*.res3 $@; } || \
+	{ shortest=`wc -l $*.res[1-3] | grep -v total | sort -n | \
+		head -1 | awk '{ print $$2; }' `; \
+		echo "** $*.out did not match the expected output"; \
+		echo "** (closest match was $$shortest)"; \
+		cp $$shortest $@; \
+		exit 1; }
 
 #-----------------------------------------------------------------------------#
 
@@ -63,8 +72,7 @@
 	rm -f *.exp
 
 clean_res:
-	rm -f *.res
-	rm -f *.res2
+	rm -f *.res*
 
 #
 # The `foo' targets make `foo_local' in the current directory before

-- 
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