[m-dev.] dos2unix

Peter Ross pro at missioncriticalit.com
Sat Nov 23 01:48:20 AEDT 2002


On Thu, Nov 21, 2002 at 12:12:01AM +1100, Fergus Henderson wrote:
> I would be happy to see a change which (1) automatically detected whether
> the tests were being run on a file system mounted in text-mode
> (e.g. by examining one of the .exp files to see if it contains "\r"),
> and (2) somehow figures out whether the output of the programs is supposed
> to be in Unix or DOS format (I guess as a first approximation you could
> check whether the output of a simple program *is* in Unix or DOS format)
> and then (3) pipes the .exp files through unix2dos or dos2unix
> as appropriate.  Such a change would make it easier to run the tests,
> since you wouldn't need to worry about whether the tests were checked
> out (or untarred, etc.) in the appropriate format.  (But it's just
> an ease-of-development issue, not even an ease-of-use issue,
> so it's certainly not release-critical ;-)
> 
What about this change, which allows the user to override the default behaviour
when needed.

===================================================================


Estimated hours taken: 0.25
Branches: main

Allow the user to pipe the output of a mercury program through another
command.  This allows one to avoid problems on systems where the
expected output is stored in a different format to that generated by
an executable.

tests/Mmake.common:
	Define the output variable CAT before including Mmake.params
	so that it can be overridden.

tests/Mmake.common:
tests/general/string_format/Mmakefile:
	Pipe the output through CAT before placing it in the .out
	file.

Index: Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.35
diff -u -r1.35 Mmake.common
--- Mmake.common	3 Nov 2002 14:28:10 -0000	1.35
+++ Mmake.common	22 Nov 2002 14:33:29 -0000
@@ -19,6 +19,7 @@
 
 MAIN_TARGET = runtests
 
+CAT=cat
 -include $(TESTS_DIR)/Mmake.params
 
 # Avoid trying to make this file with `mmc --make' if it doesn't exist.
@@ -85,7 +86,7 @@
 # the filename, which is helpful when running a parallel make.
 #
 %.out: %
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1 || \
+	{ [ -f $*.inp ] && cat $*.inp; } | ./$< | $(CAT) > $@ 2>&1 || \
 		{ grep . $@ /dev/null; exit 1; }
 
 #
Index: general/string_format/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/string_format/Mmakefile,v
retrieving revision 1.6
diff -u -r1.6 Mmakefile
--- general/string_format/Mmakefile	22 Nov 2002 14:09:30 -0000	1.6
+++ general/string_format/Mmakefile	22 Nov 2002 14:33:35 -0000
@@ -62,7 +62,7 @@
 # file if the file fails, due to the size of the output file.
 #
 %.out: %
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1 || \
+	{ [ -f $*.inp ] && cat $*.inp; } | ./$< | $(CAT) > $@ 2>&1 || \
 		{ grep . $@ /dev/null | tail -n 20; exit 1; }
 
 #

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