]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autotest: enable usage of EXEEXT in AT_TESTED
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 7 Dec 2012 13:00:19 +0000 (14:00 +0100)
committerPaolo Bonzini <bonzini@gnu.org>
Sat, 22 Dec 2012 14:34:50 +0000 (15:34 +0100)
Together with Linux's binfmt-misc feature, Wine can be used to test
cross-compiled programs as if they were native.  However, the shell
will not perform the "magic" addition of the .exe extension after a
program name when searching for an executable.  These simple patches
let the user work around this by specifying $EXEEXT in the AT_CHECK
and AT_TESTED argument.  (More care is needed because of carriage
returns, but this is beyond the scope of this series).

* tests/autotest.at (AT_INIT): Expand contents of $at_tested.
(AT_TESTED): Quote each program that is passed to the function.
* lib/autotest/general.m4 (C unit tests): Add AT_TESTED invocation
and keyword.
* doc/autoconf.texi (Writing testsuites): Document usage of variables
in AT_TESTED.
* NEWS: Document change.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
NEWS
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at

diff --git a/NEWS b/NEWS
index 6fa116afaf607d72d2f9f62c266ce268559a7e4a..185ca263da8667d14105e887c1cdf7790ad9b7b8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,8 @@ GNU Autoconf NEWS - User visible changes.
 - AC_CONFIG_TESTDIR will automatically pass EXEEXT to a testsuite (via
   the atconfig file).
 
+- AT_TESTED arguments can use variable or command substitutions, including
+  in particular $EXEEXT
 
 * Noteworthy changes in release 2.69 (2012-04-24) [stable]
 
index c9c1677d8a2616895b443dc6c0a1ca34f7e063ee..aa948a9036ab5d69b3cad7d90aa9d8c8f15a2866 100644 (file)
@@ -25013,6 +25013,12 @@ programs are being exercised is crucial to understanding problems in
 the test suite itself, or its occasional misuses.  It is a good idea to
 also subscribe foreign programs you depend upon, to avoid incompatible
 diagnostics.
+
+@var{executables} is implicitly wrapped in shell double quotes, but it
+will still use shell variable expansion (@samp{$}), command substitution
+(@samp{`}), and backslash escaping (@samp{\}).  In particular, the
+@env{EXEEXT} variable is available if it is passed to the testsuite
+via @file{atlocal} or @file{atconfig}.
 @end defmac
 
 @sp 1
index 7be2e3bc23f73b3ec90dd0cb148d7b87cea995e5..88b6c1dd53ebce474c43c2f414f5c15b1d19b83b 100644 (file)
@@ -1001,7 +1001,7 @@ m4_divert_push([PREPARE_TESTS])dnl
 } >&AS_MESSAGE_LOG_FD
 
 # Report what programs are being tested.
-for at_program in : $at_tested
+for at_program in : `eval echo $at_tested`
 do
   test "$at_program" = : && continue
   case $at_program in
@@ -1794,7 +1794,7 @@ m4_defun([AT_ARG_OPTION_ARG],[_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])])
 # must correspond to the version of the package.  PATH should be
 # already preset so the proper executable will be selected.
 m4_define([AT_TESTED],
-[m4_append_uniq_w([AT_tested], [$1])])
+[m4_append_uniq_w([AT_tested], ["$1"])])
 
 
 # AT_COPYRIGHT(TEXT, [FILTER = m4_newline])
index 78e8c6bba56c3dd52d0fc6689b26e960a55be698..401cfc3b3646ab22ac6e99f288211c5e42098a8d 100644 (file)
@@ -1892,6 +1892,7 @@ AT_CLEANUP
 
 AT_SETUP([C unit tests])
 AT_KEYWORDS([AC_@&t@CONFIG_TESTDIR])
+AT_KEYWORDS([AT_@&t@TESTED])
 
 mkdir t
 AT_DATA([configure.ac], [[AC_INIT
@@ -1923,6 +1924,7 @@ testprog.o: testprog.c
 
 AT_CHECK_AT_PREP([suite],
 [[AT_INIT([suite to check C programs])
+AT_TESTED([testprog$EXEEXT])
 AT_SETUP([my only test])
 AT_CHECK([testprog$EXEEXT foo], [0])
 AT_CHECK([testprog$EXEEXT], [1])
@@ -1945,6 +1947,7 @@ AT_CLEANUP
 
 AT_SETUP([C unit tests (EXEEXT)])
 AT_KEYWORDS([AC_@&t@CONFIG_TESTDIR])
+AT_KEYWORDS([AT_@&t@TESTED])
 
 mkdir t
 AT_DATA([configure.ac], [[AC_INIT
@@ -1982,6 +1985,7 @@ testprog.o: testprog.c
 
 AT_CHECK_AT_PREP([suite],
 [[AT_INIT([suite to check C programs])
+AT_TESTED([testprog$EXEEXT])
 AT_SETUP([my only test])
 AT_CHECK([testprog$EXEEXT foo], [0])
 AT_CHECK([testprog$EXEEXT], [1])