diff: fix test case results

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 4 18:33:41 AEDT 1998


tests/Mmake.common:
	Allow test cases to have more than one expected output.

tests/general/string_format_test_2.exp2:
tests/general/string_format_test_3.exp2:
tests/hard_coded/no_fully_strict.exp2:
	Add alternative expected output for these
	test cases, since the output is different
	depending on whether or not the program is
	compiled in a grade that supports stack traces.

Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.12
diff -u -r1.12 Mmake.common
--- Mmake.common	1998/08/04 14:06:10	1.12
+++ Mmake.common	1998/11/04 07:24:55
@@ -11,6 +11,8 @@
 # if you want to rebuild the `.exp' files.
 HAVE_NUPROLOG=no
 
+DIFF_OPTS=-c
+
 #-----------------------------------------------------------------------------#
 
 # .PRECIOUS: %.mod %.c %.o %_init.c %.no %.nu %_init.nl %_init.no
@@ -20,9 +22,16 @@
 %.out: %
 	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
 
+#
+# 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.
+#
 %.res: %.exp %.out
 	-rm -f $@
-	diff -c $*.exp $*.out > $@
+	diff $(DIFF_OPTS) $*.exp $*.out > $@ || \
+		{ [ -f $*.exp2 ] && diff $(DIFF_OPTS) $*.exp2 $*.out > $@; }
 
 #-----------------------------------------------------------------------------#
 
Index: tests/general/string_format_test_2.exp2
===================================================================
RCS file: string_format_test_2.exp2
diff -N string_format_test_2.exp2
--- /dev/null	Wed Nov  4 17:07:03 1998
+++ string_format_test_2.exp2	Wed Nov  4 18:28:03 1998
@@ -0,0 +1,8 @@
+Software error: string__format: argument list has more elements than format string
+Stack dump follows:
+        0       pred require:error/1-0 (erroneous)
+        1    5* pred string:format_2/3-0 (det)
+        6       pred string:format/3-0 (det)
+        7       pred io:format/5-0 (det)
+        8       pred io:format/4-0 (det)
+        9       pred string_format_test_2:main/2-0 (det)
Index: tests/general/string_format_test_3.exp2
===================================================================
RCS file: string_format_test_3.exp2
diff -N string_format_test_3.exp2
--- /dev/null	Wed Nov  4 17:07:03 1998
+++ string_format_test_3.exp2	Wed Nov  4 18:27:53 1998
@@ -0,0 +1,8 @@
+Software error: string__format: argument list has fewer elements than format string
+Stack dump follows:
+        0       pred require:error/1-0 (erroneous)
+        1       pred string:format_2/3-0 (det)
+        2       pred string:format/3-0 (det)
+        3       pred io:format/5-0 (det)
+        4       pred io:format/4-0 (det)
+        5       pred string_format_test_3:main/2-0 (det)
Index: tests/hard_coded/no_fully_strict.exp2
===================================================================
RCS file: no_fully_strict.exp2
diff -N no_fully_strict.exp2
--- /dev/null	Wed Nov  4 17:07:03 1998
+++ no_fully_strict.exp2	Wed Nov  4 18:26:26 1998
@@ -0,0 +1,4 @@
+Software error: oops
+Stack dump follows:
+        0       pred require:error/1-0 (erroneous)
+        1       pred no_fully_strict:main/2-0 (det)

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



More information about the developers mailing list