2
0
mirror of git://git.sv.gnu.org/autoconf synced 2025-03-07 14:26:52 +08:00

autotest: enable usage of EXEEXT in AT_TESTED

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>
This commit is contained in:
Paolo Bonzini 2012-12-07 14:00:19 +01:00
parent d902536845
commit 851ef51796
4 changed files with 14 additions and 2 deletions

2
NEWS
View File

@ -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]

View 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

View 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])

View 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])