[m-dev.] diff: tests/Mmake.common: print out failing `.out' files

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 6 07:54:05 AEST 1999


Estimated hours taken: 0.25

tests/Mmake.common:
	If the execution of a test program fails,
	then print out the `.out' file.

Workspace: /home/mercury0/fjh/mercury
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.15
diff -u -r1.15 Mmake.common
--- Mmake.common	1999/07/14 17:02:46	1.15
+++ Mmake.common	1999/10/05 21:51:01
@@ -19,8 +19,17 @@
 
 %_init.c: Entry
 
+#
+# If there is a `.inp' file, then we pipe that in as the command's input.
+# Then we run the command, with stdout and stderr both redirected to the 
+# `.out' file.  Finally if the command fails (returns non-zero exit status),
+# we print out the contents of the `.out' file.  We use `grep . $@ /dev/null'
+# to print out the contents, because that precedes each line of output with
+# the filename, which is helpful when running a parallel make.
+#
 %.out: %
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
+	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1 || \
+		{ grep . $@ /dev/null; exit 1; }
 
 #
 # For some test cases, there is more than one valid output.

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