]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Make AT_CHECK_UNQUOTED more like AC_DEFINE_UNQUOTED.
authorEric Blake <ebb9@byu.net>
Fri, 24 Apr 2009 14:46:59 +0000 (08:46 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 24 Apr 2009 19:15:25 +0000 (13:15 -0600)
* lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Keep older,
undocumented semantics, where unbalanced " cannot be used in the
stdout/stderr argument.
(AT_CHECK_UNQUOTED): Treat " in stdout/stderr as a literal, since
the text is used in double-quoted context.
* tests/autotest.at (unquoted output): New test.
* doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Mention which
shell expansions are handled.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at

index 1307b0c6ec5fe5967e52445dc0eb09149f5f97ab..a4c6332767836b4b8944541a9079b37ea1d4ca08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-04-24  Eric Blake  <ebb9@byu.net>
 
+       Make AT_CHECK_UNQUOTED more like AC_DEFINE_UNQUOTED.
+       * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Keep older,
+       undocumented semantics, where unbalanced " cannot be used in the
+       stdout/stderr argument.
+       (AT_CHECK_UNQUOTED): Treat " in stdout/stderr as a literal, since
+       the text is used in double-quoted context.
+       * tests/autotest.at (unquoted output): New test.
+       * doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Mention which
+       shell expansions are handled.
+
        Rename AT_CHECK_NOESCAPE to AT_CHECK_UNQUOTED.
        * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Deprecate, in favor
        of new spelling...
index d1a77fa6854a75ef714338bccad2ac62bc9a4072..b013afa598de8bf652ba395d98875f8ff353c213 100644 (file)
@@ -8760,7 +8760,8 @@ the last one wins.
 Like @code{AC_DEFINE}, but three shell expansions are
 performed---once---on @var{variable} and @var{value}: variable expansion
 (@samp{$}), command substitution (@samp{`}), and backslash escaping
-(@samp{\}).  Single and double quote characters in the value have no
+(@samp{\}), as if in an unquoted here-doc.  Single and double quote
+characters in the value have no
 special meaning.  Use this macro instead of @code{AC_DEFINE} when
 @var{variable} or @var{value} is a shell variable.  Examples:
 
@@ -22434,10 +22435,13 @@ parameter is treated as text that must exactly match the output given by
 @var{commands} on standard out and standard error (including an empty
 parameter for no output); any differences are captured in the testsuite
 log and the test is failed.  The difference between @code{AT_CHECK} and
-@code{AT_CHECK_UNQUOTED} is that only the latter performs shell
-expansions on comparison text given in the @var{stdout} and @var{stderr}
-arguments (however, there is no difference in the interpretation of
-@var{commands}).
+@code{AT_CHECK_UNQUOTED} is that only the latter performs shell variable
+expansion (@samp{$}), command substitution (@samp{`}), and backslash
+escaping (@samp{\}) on comparison text given in the @var{stdout} and
+@var{stderr} arguments; if the text includes a trailing newline, this
+would be the same as if it were specified via an unquoted
+here-doc.  (However, there is no difference in the interpretation
+of @var{commands}).
 
 @table @samp
 @item ignore
index f959a4189395e9dfc5038f7ba0a0008bbc4f0d69..a16224b8980c37b6be4b4426bb924af626fe78ba 100644 (file)
@@ -1910,16 +1910,17 @@ _AT_DEFINE_SETUP([AT_CHECK],
 # Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT
 # and STDERR arguments before running the comparison.
 _AT_DEFINE_SETUP([AT_CHECK_UNQUOTED],
-[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
-  m4_expand([$4]), [$5], [$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3])), [""]),
+  AS_ESCAPE(m4_dquote(m4_expand([$4])), [""]), [$5], [$6])])
 
 # AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
 # ---------------------------------------------------------
 # Obsolete spelling of AT_CHECK_UNQUOTED.
 m4_define([AT_CHECK_NOESCAPE],
-[m4_warn([obsolete], [use AT_CHECK_UNQUOTED instead of $0])]dnl
-[AT_CHECK_UNQUOTED($@)])
+[m4_warn([obsolete], [consider using AT_CHECK_UNQUOTED instead of $0])]dnl
+[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
+  m4_expand([$4]), [$5], [$6])])
 
 
 # _AT_DECIDE_TRACEABLE(COMMANDS)
index 827808cd01535909f77da7e549efe72a633f57c6..0fad78db67a075aa5dc43eaa3ec756ce6409d46b 100644 (file)
@@ -287,6 +287,13 @@ AT_CHECK_AT_TEST([errexit],
    AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])],
   [--errexit])
 
+AT_CHECK_AT_TEST([unquoted output],
+  [m4_define([backtick], [`])
+   a=a
+   AT_CHECK_UNQUOTED([echo 'a"b  backtick`'], [],
+     [${a}"`echo 'b  '`\`\backtick]m4_newline)],
+  [], [], [], [], [AT_KEYWORDS([AT@&t@_CHECK_UNQUOTED])])
+
 AT_CHECK_AT([Logging],
   [[AT_INIT([artificial test suite])
     dnl intentionally write failing tests, to see what gets logged