autoconf
[Top][All Lists]
Advanced

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

RE: autotest/AT_CHECK: ways to pass additional options on to diff?


From: Jannick
Subject: RE: autotest/AT_CHECK: ways to pass additional options on to diff?
Date: Thu, 25 Apr 2019 22:16:45 +0200

Hi Nick,

First of all many thanks for your swift reply and apologies for me replying
late.

I took my Easter break and a bit more to have a pretty loooong journey
through the autoconf lands which was a bit hilly, since I am a complete
newbie to autoconf and its friends.

There is an elegant solution to the problem. Please see below.

On Tue, 16 Apr 2019 15:20:17 -0400, Nick Bowler wrote:
> Aside from hackery like you describe, I do not believe there is any
built-in
> way to modify the behaviour of AT_CHECK like this.

Agree - this quote from the AUTOCONF manual (chap. 19.2, macro AT_CHECK)
confirms that the built-in diff command expects EXACT text matches:
"Otherwise, the value of the parameter is treated as text that must exactly
match the output given by commands on standard output and standard error
(including an empty parameter for no output);" ... but let's see, there is
some light at the end of the tunnel.

> But you can just do whatever comparison you want directly in AT_CHECK...
> there is no reason to use the built-in diff when it is inadequate for your
test
> case.
>
> For example, if I want to use 'cmp' instead of 'diff' I might write
> (untested):
>
>   AT_CHECK([:; { commands_to_generate_output
>   } >stdout && cmp stdout expected_output])
>
> And if I did that a lot I would define a macro for it.

Understand.  My use case is a little bit different, since I am encountering
issues on my Windows box (ahem) when running tests of packages which give no
reason to complain about on Linux/Unix systems: This takes us to the CRLF
hell, since in general printf writes on Windows files with EOL CRLF (there
is a way to circumvent that not applied in most of the packages I came
across in the recent past).  So I came up with the question as to how to
adjust autotest script to help me using 'diff --strip-trailing-cr'. The idea
was that then the issue would have been blown away.

But there is an elegant solution to that, whereas in the beginning I was too
'narrow-minded' because of the host of information about the autoconf
machinery I had to process and to cope with: simply offer autotest a
customized script called 'diff' - surprise surprise - the testsuite script
finds **first** on PATH.  This solution does not change any package, but
rather the environment autoconf finds itself in.  This is easily established
on the command line.

This solution sounds easy and simple, but I must admit it took me a while
for a decent battle with autoconf and its friends and to find out this slot.
The evil hackery I was talking about in the first place is gone, of course.

Today, after having gone through a lot of autoconf script lines, I am pretty
sure that the autoconf fathers did think of some sort of this problem/my
problem.  Well designed in this respect!

BTW: Some people suggested that on Windows gitting a package with EOLs
converted to CRLF would resolve the autotest comparison issue. True - but
then they will be in pretty hot water somewhere else:  bash complains about
shell scripts containing a confusing '\r', such that no package script as is
can be run anymore.  So this supposedly simple solution does not fly without
tedious fiddling around with files.

> Cheers,
>   Nick

Best,
J.




reply via email to

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