Autoconf’s diagnostics now follow current GNU coding standards,
which say that diagnostics in the C locale should quote 'like this'
with plain apostrophes instead of the older GNU style `like this'
with grave accent and apostrophe.
The absolute-path case in AT_TESTED had a typo in it, causing bizarre
error messages and preventing programs identified by absolute path
from being logged properly.
* lib/autotest/general.m4 (AT_TESTED): Fix typoed shell syntax in
handling of programs identified by absolute path.
Currently, there isn’t any documented way for an Autotest testsuite to
add custom code to be run either right before the main driver loop, or
at the point of each AT_SETUP. For instance, there’s no good place to
put environment variable sanitization that should apply to the entire
testsuite (but isn’t universally relevant), or shell function
definitions to be used by custom test macros.
Autoconf’s test suite is poking shell functions directly into the
PREPARE_TESTS diversion, and doing environment variable sanitization
in each individual test. Both of these are obviously undesirable.
This patch adds three new AT_* macros that can be used to do these
things in an officially-supported way: AT_PREPARE_TESTS adds code to
be run right before the main driver loop, AT_PREPARE_EACH_TEST adds
code to be run at the beginning of each test, and AT_TEST_HELPER_FN
defines a shell function that will be available to each test. In
Autoconf’s test suite, I use AT_PREPARE_TESTS to factor out
environment variable sanitization that *ought* to apply across the
board, and AT_TEST_HELPER_FN for the helper function used by
AT_CHECK_ENV.
(This fixes the testsuite bug reported by Jannick at
https://lists.gnu.org/archive/html/autoconf/2020-10/msg00052.html :
CONFIG_SITE in the parent environment will no longer be visible to tests.)
It would be nice to give an example of when AT_PREPARE_EACH_TEST is
useful, in the documentation, but I didn’t find one in the autoconf
test suite.
* lib/autotest/general.m4 (AT_PREPARE_TESTS, AT_PREPARE_EACH_TEST)
(AT_TEST_HELPER_FN): New macros.
(AT_INIT, AT_TESTED): Emit the code to report tested programs only
if it’s needed, and make sure it’s after any code added by
AT_PREPARE_TESTS.
* tests/local.at: Add AT_PREPARE_TESTS block that ensures
$MAKE is set sensibly and $MAKEFLAGS and $CONFIG_SITE are unset.
Use AT_TEST_HELPER_FN for the helper function needed by AT_CHECK_ENV.
(AT_CHECK_MAKE): No need to sanitize $MAKE or $MAKEFLAGS here.
* tests/base.at, tests/compile.at, tests/m4sh.at, tests/torture.at:
No need to unset or neutralize $CONFIG_SITE in individual tests.
* tests/autotest.at: Add tests for new macros.
* doc/autoconf.texi, NEWS: Document new macros.
Another regression identified by the Debian archive rebuild was that
more macros require the presence of config.sub and config.guess now.
‘autoreconf --install’ doesn’t install these itself, it relies on
‘automake --add-missing’ to do that; so, packages that don’t use
Automake will fail at the configure stage after configure is
regenerated. To make matters worse, AC_CONFIG_AUX_DIRS assumes that
everyone who needs config.sub and config.guess also needs install-sh,
so in about half of the affected packages, the failure manifested as a
complaint about install-sh being missing -- technically true but
adding install-sh wouldn’t have resolved the problem by itself.
This patch overhauls the AC_CONFIG_AUX_DIR(S) mechanism so that a
configure script knows the complete set of aux scripts that were
AC_REQUIRE_AUX_FILE’d for it, checks for the existence of all of
them, and not any others. Thus, this configure script
AC_INIT([test], [1.0])
AC_FUNC_MALLOC
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
will work fine in a directory that contains config.sub and
config.guess but not install-sh. Also, if it’s in a directory
that *doesn’t* contain config.sub and config.guess, it will print an
accurate error message
configure: error: cannot find required auxiliary files: config.guess config.sub
instead of the misleading
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
A side-effect: it doesn’t make sense for AC_CONFIG_SUBDIRS to demand
the presence of Cygnus configure in the aux dir, on the off-chance
that one of the subdirectories *might* be using it -- I have no idea
where someone would even get a copy of that nowadays -- so I dropped
that feature. I rather suspect nobody has needed it in over a decade.
I also documented the expanded need for config.sub and config.guess in
NEWS as well as the manual.
* NEWS: Document expanded need for config.sub and config.guess.
Document removed support for Cygnus configure in subdirectories.
* doc/autoconf.texi: Clarify exactly when install-sh, config.sub,
and/or config.guess are required. Document canonical online sources
for these scripts. Revise documentation of AC_CONFIG_AUX_DIR and
AC_REQUIRE_AUX_FILE. Minor improvements to documentation of
AC_CONFIG_SRCDIR. Remove mentions of Cygnus configure in
subdirectories.
* lib/autoconf/general.m4
(_AC_INIT_PARSE_ARGS): Remove mention of Cygnus configure;
clarify function of configure.gnu.
(AC_CONFIG_AUX_DIR): Support multiple invocations.
(AC_CONFIG_AUX_DIRS): Now an undocumented compatibility interface
rather than an internal subroutine; just runs AC_CONFIG_AUX_DIR on
each of its arguments.
(AC_CONFIG_AUX_DIR_DEFAULT): Now a backward compatibility stub that
requires _AC_INIT_AUX_DIR without adding anything to _AC_AUX_FILES.
(AC_REQUIRE_AUX_FILE): Now adds the named aux file to _AC_AUX_FILES
and requires _AC_INIT_AUX_DIR, as well as being a trace hook.
(_AC_INIT_AUX_DIR): New home of the loop searching for necessary aux
files (formerly in AC_CONFIG_AUX_DIRS). Looks for all the necessary
aux files, not just for install-sh.
(ac_config_guess, ac_config_sub, ac_configure): Issue deprecation
warnings if these undocumented shell variables are actually used.
(AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_TARGET):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
Can rely on $ac_aux_dir ending with a slash.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS):
No need to require AC_CONFIG_AUX_DIR_DEFAULT.
Remove check for Cygnus configure; clarify function of configure.gnu.
* lib/autotest/general.m4: Remove mention of Cygnus configure.
* tests/torture.at (Missing auxiliary files): New test.
* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autoconf/programs.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autotest/general.m4 (AT_INIT):
Rewrite to avoid ${VAR-VALUE} where VALUE is not a shell word.
Based on an idea by Bernhard Reutner-Fischer.
We frequently used the idiom of 'test "${var+set}" = set' to
test if $var was set to a non-empty string, but this can portably
be trimmed to a more compact 'test ${var+y}' for a smaller
configure file. Testing that a variable is not set can be done
with '${var+false} :' (although the value of $? is not reliably
1 when the variable is set).
The code for AS_VAR_TEST_SET already used the form '${var+:} false',
but it is slightly longer, and does not guarantee $? of 1.
Tested on coreutils, where the resulting configure file is about
1k smaller.
* doc/autoconf.texi (Shell Substitutions): Prefer shorter sequence
for testing if a variable is set.
(Limitations of Builtins) <test (strings)>: Document it.
* configure.ac: Use it.
* lib/autoconf/c.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G)
(_AC_PROG_OBJC_G, _AC_PROG_OBJCXX_G): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_G): Likewise.
* lib/autoconf/general.m4 (_AC_ENABLE_IF_ACTION, AC_CACHE_SAVE):
Likewise.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Likewise.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P)
(_AC_PROG_LEX_YYTEXT_DECL): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_MAIN_LOOP): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* tests/base.at (AC_CACHE_CHECK): Likewise.
* tests/m4sh.at (LINENO): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_BOURNE_COMPATIBLE)
(_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE)
(_AS_PATH_SEPARATOR_PREPARE): Likewise.
(AS_VAR_TEST_SET): Use shorter sequence.
Signed-off-by: Eric Blake <eblake@redhat.com>
Done via 'make update-copyright', since all files are effectively
modified and distributed this year via public version control.
* all files: Update copyright year.
* lib/autotest/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'autotest'.
Other minor related modifications.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/autotest/Makefile'.
* lib/freeze.mk (MY_AUTOM4TE): Small required adjustments.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Done via 'make update-copyright', since all files are effectively
modified and distributed this year via public version control.
* all files: Update copyright year.
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>
* lib/autotest/general.m4 (AT_DATA_UNQUOTED): New macro, paralleling
AT_DATA but not quoting the contents.
* doc/autoconf.texi (Writing Testsuites): Document it.
* tests/autotest.at (AT_DATA_UNQUOTED): Test it.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
As reported by Paul Keir on the cygwin lists,
http://cygwin.com/ml/cygwin/2012-07/msg00263.html,
some people like to stick / in their $PATH, and if we then try
to probe $as_dir/progname for existence, we can end up causing
cygwin to have a several-second timeout per //name probe. It
is better to avoid inserting the extra slash when $as_dir is the
root directory, and simpler to code by always having a trailing
slash present than it is to strip a trailing slash. Thankfully,
_AS_PATH_WALK is an undocumented interface, and even if someone
was using it in spite of the warnings, their use of $as_dir/foo
will typically only lead to odd-looking /dir//foo probes, with
only the case of / in $PATH causing slowdowns, and only when //
is special.
There was also a minor bug where the if-not-found code of
_AS_PATH_WALK could be executed with $IFS still in the wrong state.
* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Always end as_dir in /.
Avoid wrong IFS during if-not-found. Minor optimization to avoid
regex.
(_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE): Update clients.
* lib/autotest/general.m4 (_AT_FINISH): Likewise.
* lib/autoconf/programs.m4 (_AC_CHECK_PROG, _AC_PATH_PROG)
(_AC_PATH_PROGS_FEATURE_CHECK, _AC_PATH_PROG_FLAVOR_GNU): Likewise.
* lib/autotest/general.m4 (AT_DATA): Special case an empty data
file, since zsh botches empty here-docs.
* doc/autoconf.texi (Writing Testsuites) <AT_DATA>: Document that
this allows empty contents.
* tests/autotest.at (AT_DATA): New test.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autotest/general.m4 (AT_INIT): Remove definition of
AT_groups_all. Initialize at_groups from at_help_all, with
newlines instead of spaces separating test groups numbers.
Adjust all code to newlines.
* NEWS: Update.
* tests/autotest.at (Huge testsuite): New test.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_postprocess>:
Exit after an unexpected passing test if $at_errexit.
* tests/autotest.at (errexit): Also try tests that xpass, skip,
xfail, or fail hard.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_postprocess>:
Don't cleanup the group directory when a test unexpectedly passes.
* tests/autotest.at (Cleanup): Check that an unexpected pass leaves
the test group directory intact.
Signed-off-by: Peter Rosin <peda@lysator.liu.se>
* doc/autoconf.texi (Writing Testsuites) <AT_BANNER>: Update
description.
* lib/autotest/general.m4 (AT_INIT) <at_fn_banner>: Set banner
to single space, not empty line, once printed. For empty
banners, print a single empty line to separate them from a
previous test group category.
* tests/autotest.at (Banners): Insert another test group; adjust
tests accordingly. Extend test to cover semantic change.
* NEWS: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT) <serial testing>: Changing
at_jobs here breaks output if -j2 was requested but shell is
insufficient to support parallel testing.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autotest/general.m4 (AT_INIT) <serial testing>: Ensure
at_jobs is 1.
(AT_SETUP, AT_CLEANUP): Factor initialization code...
(AT_INIT) <at_fn_group_banner>: ...into new function.
Based in part on suggestion by Ralf Wildenhues.
Signed-off-by: Eric Blake <eblake@redhat.com>
* doc/autoconf.texi (File Descriptors): Clarify limitations.
* lib/autotest/general.m4 (AT_CLEANUP): Avoid leaking job control
fifo fd to user tests.
(AT_INIT): Delete comment, now that close is done elsewhere.
Suggested by Ralf Wildenhues.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autotest/general.m4 (AT_INIT) <Fifo job dispatcher>: Track
two fds to fifo in parent, to avoid race where parent can see EOF
before child opens fifo. Avoid any atomicity problems with tokens
larger than one byte.
* NEWS: Document the bug fix.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autotest/general.m4 (_AT_FINISH) <banners>: Rather than
doing a recursive find, limit ourselves to top ChangeLog only.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autotest/general.m4 (_AT_ARG_OPTION): Fix translation of
hyphens to underscores when turning option names to variables.
Avoid macro name concatenation garbage with trailing `dnl'.
(AT_ARG_OPTION, AT_ARG_OPTION_ARG): Overhaul macro description.
The OPTIONS are space-separated, not comma-separated. The
negative form of AT_ARG_OPTION is prefixed with `--no-'.
* tests/autotest.at (AT@&t@_ARG_OPTION, AT@&t@_ARG_OPTION_ARG):
New tests.
* NEWS: Update.
* doc/autoconf.texi (Writing Testsuites): Document AT_ARG_OPTION
and AT_ARG_OPTION_ARG.
(testsuite Invocation): Call the thingies passed to the
testsuite options, not arguments. Note that the testsuite
author may add further package-specific options.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (HELP_TUNING_BEGIN): New diversion.
(HELP_TUNING, HELP_OTHER, HELP_END): Bump diversion numbers.
(AT_INIT): Accept
--color and --color=never|auto|always. If desired, colorize
test results and testsuite summary on standard output.
[HELP_TUNING]: Divert content instead to ...
[HELP_TUNING_BEGIN]: ... this diversion, m4_wrapped until the
end, when we know whether AT_COLOR_TESTS has been specified.
(AT_COLOR_TESTS): New macro, set the default for color to auto.
* doc/autoconf.texi (Writing Testsuites): Document it.
(testsuite Invocation): Document --color* options.
* tests/local.at: Call AT_COLOR_TESTS for Autoconf's testsuite.
* tests/autotest.at (color test results): New test, mirroring
color.test from Automake.
* NEWS: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT): New variable $at_recheck.
Escape hyphen in $at_dir early. Accept command line switch
--recheck. Set $at_suite_log early, based on --directory
switch; with --recheck, include the list of FAILed and XPASSed
tests from old testsuite.log file in $at_groups. Document
--recheck in --help output.
* tests/autotest.at (recheck): New test.
* doc/autoconf.texi (testsuite Invocation): Document --recheck.
* NEWS: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* doc/autoconf.texi (Autoconf Language, Generic Structures):
Do not capitalize the first word in error messages, do not end
them with a period.
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS, AC_MSG_FAILURE):
Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): Likewise.
* lib/autotest/general.m4 (AT_INIT, at_fn_group_prepare):
Likewise.
* m4/m4.m4 (AC_PROG_GNU_M4): Likewise.
* tests/base.at (AC_TRY_COMMAND): Likewise.
* tests/torture.at (datarootdir workaround): Adjust expected
message.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_CLEANUP): Actually print test
title in verbose output. Fixes AUTOCONF-2.57-101-gc102ed8
regression.
* tests/autotest.at (AT_CHECK_AT_TITLE): Amend macro to check
for test title in -v output.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT) <PREPARE_TESTS>: Check for
absolute names before path walk.
* THANKS: Update.
Suggested by Allan Clark.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autotest/general.m4 (AT_INIT): Hint at the toplevel log
only if not $at_debug_p. Always hint at the per-test output.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/specific.m4 (AT_CHECK_EUNIT): Support older
versions of Erlang/OTP with an erlang:stop() function that doesn't
take arguments.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>