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...
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:
@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
# 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)
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