[m-dev.] dos2unix

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 21 00:12:01 AEDT 2002


On 20-Nov-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 20-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > On the IL backend the output of the tests are in dos format while the
> > expected output of the tests are in Unix format.  I solve this by piping the
> > output through dos2unix before saving it to a file.
> > 
> > Does anyone have objections to this solution or a better way to solve this
> > problem?
> 
> The right solution is to do `cvs checkout tests' on a Cygwin file
> system which has been mounted in text mode.

And yes, I do object to piping the output of the tests through dos2unix,
since that will fail to detect bugs where the test output is (incorrectly)
already in Unix format.

If you did want to do it that way, it would be better to pipe the .exp
files through unix2dos.  That would avoid the problem mentioned above.

Note that it's not just the IL back-end; the same problem occurs for the C
back-ends if you link with the MS library (using MSVC or Mingw) rather
than the Cygwin library.

Also this should not always be done for the IL back-end;
if we're using the IL back-end with a Unix (or Cygwin)
version of Mono or Portable.Net, for example, then the output
should be in Unix format.

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

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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