[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 05no-escape-on-AT_CHECK-strings
From: |
Akim Demaille |
Subject: |
Re: 05no-escape-on-AT_CHECK-strings |
Date: |
Sat, 29 Mar 2003 17:15:12 +0100 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
Derek> Akim Demaille wrote:
>> I am absolutely against this patch. Revert it.
>>
>> If you want something like this, you will first need to explain it.
>>
Derek> Again, CVS's current test suite often compares program output against
Derek> shell variables defined earlier in the script.
Then save these values in an expout file, and use [expout] as STDOUT
value.
Derek> A simple example of this is that CVS uses a configure option,
Derek> provided by Autoconf, to allow setting of the program prefix
Derek> (AC_PROGRAM_PREFIX). This can alter CVS's $0 and thus its
Derek> error messages. If AC_CHECK doesn't escape the STDOUT &
Derek> STDERR strings then variables like this can be passed in for
Derek> comparison.
I might miss something, but you want to read some piece of
documentation here:
http://www.lrde.epita.fr/~akim/compil/gnuprog2.html#Software%20Testing%20with%20Autotest
and especially all the fuss about wrappers. I think Autoconf's
documentation also includes information about wrappers. Have a look
at m4.in in CVS m4:
----------------------------------------
#! /bin/sh
# @configure_input@
# Wrapper around a non installed m4 to make it work as an installed one.
"@abs_top_builddir@/src/m4" \
--module-directory="@abs_top_builddir@/modules" \
${1+"$@"} 2>/tmp/m4-$$
status=$?
# Normalize stderr.
# - If configure --disable-shared, then src/m4 is a real program,
# neutralize the full path display
# - otherwise, it is a libtool wrapper, relying on PATH to execute the
# actual program, either lt-m4, or m4.
#
# - In both cases, beware of .exe.
sed 's,^[^:]*[lt-]*m4[.ex]*:,m4:,' /tmp/m4-$$ >&2
rm /tmp/m4-$$
exit $status
----------------------------------------
For a different approach (not recommended actually, I should change
this and move it into the wrapper), see Autoconf's
# AT_CHECK_AUTOM4TE(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)
# -----------------------------------------------------------
# If stderr is specified, normalize the observed stderr. E.g. (GNU M4 1.5):
#
# /usr/local/bin/m4: script.4s: 1: Cannot open foo: No such file or directory
# autom4te: /usr/local/bin/m4 failed with exit status: 1
#
# or (using gm4 as GNU M4 1.4):
#
# script.4s:1: /usr/local/bin/gm4: Cannot open foo: No such file or directory
# autom4te: /usr/local/bin/m4 failed with exit status: 1
#
# becomes
#
# m4: script.4s: 1: Cannot open foo: No such file or directory
# autom4te: m4 failed with exit status: 1
#
# We use the following sed patterns:
#
# (file): (line): (m4):
# or (m4): (file): (line):
# to m4: (file): (line):
#
# and
# autom4te: [^ ]m4
# to autom4te: m4
m4_define([AT_CHECK_AUTOM4TE],
[AT_CHECK([autom4te $1], [$2], [$3], m4_ifval([$4], [stderr]))
m4_ifval([$4],
[AT_CHECK([[sed -e 's,^\([^:]*\): *\([0-9][0-9]*\): *[^:]*m4: ,m4: \1: \2: ,' \
-e 's,^[^:]*m4: *\([^:]*\): *\([0-9][0-9]*\): ,m4: \1: \2: ,' \
-e 's/^autom4te: [^ ]*m4 /autom4te: m4 /' \
-e 's/^autom4te: [^ ]*m4.exe /autom4te: m4 /' \
-e 's/ (E[A-Z]*)$//' \
stderr]], [0],[$4])])
])