From 851ef517963d1e1966c4082530d5e87ba0a415ab Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 7 Dec 2012 14:00:19 +0100 Subject: [PATCH] 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 --- NEWS | 2 ++ doc/autoconf.texi | 6 ++++++ lib/autotest/general.m4 | 4 ++-- tests/autotest.at | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6fa116af..185ca263 100644 --- 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] diff --git a/doc/autoconf.texi b/doc/autoconf.texi index c9c1677d..aa948a90 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 7be2e3bc..88b6c1dd 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -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]) diff --git a/tests/autotest.at b/tests/autotest.at index 78e8c6bb..401cfc3b 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -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]) -- 2.11.4.GIT