autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cmp in test scripts


From: Tim Van Holder
Subject: Re: cmp in test scripts
Date: 25 Jan 2002 08:40:24 +0100

On Fri, 2002-01-25 at 02:09, Earnie Boyd wrote:
> John Poltorak wrote:
> > 
> > On Thu, Jan 24, 2002 at 06:00:36PM -0500, Earnie Boyd wrote:
> > > John Poltorak wrote:
> > > >
> > > > Is there any way that autoconf can be used to handle cmp in test 
> > > > scripts?
> > > >
> > > > Occasionally a test will fail because of the use of cmp to test
> > > > differences between generated data and expected results due to line
> > > > termination on DOS filesystems. If diff is used instead the test may
> > > > succeed.
> > > >
> > > > What I'd like to see is some check to see if the use of cmp is valid and
> > > > if not then maybe set CMP=diff ...
> > > >
> > >
> > > What shell are you using on the DOS filesystem?  A properly ported cmp
> > > would be a better solution.
> > 
> > What relevance does the shell have?
> > 
> 
> Worlds of difference.  A properly ported shell might eliminate the
> concern for a properly ported cmp.  Are you talking strictly MSDOS or
> are you talking COMMAND.COM/CMD.EXE or are you talking UWIN or are you
> talking CYGWIN or are you talking ...

A shell has absolutely NOTHING to do with how a program reads a file.

> > "hello, world\n" is longer on a DOS filesystem than on Unix so cmp will
> > distinguish between whereas diff won't.
> > 
> 
> No it isn't.  "hello, world\n" is the same size in both worlds.  "hello,
> world\r\n" is the same size in both worlds.  A properly ported cmp would
> be a better method.

It IS properly ported.  cmp is supposed to compare file DATA (on a
per-byte basis).  As such it HAS to distinguish between DOS text, Mac
text and Unix text (and whatever other forms are there), because the
FILES differ.
'diff' on the other hand, is supposed to show differences in a file's
CONTENTS, which is a higher-level concept.  For it, text is text, and
line endings don't necessarily have to count as different.  As such,
diff (or diff -a, if that's a portable option) is better at determining
difference between text files than cmp.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]