]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Three minor testsuite fixes.
authorZack Weinberg <zackw@panix.com>
Tue, 8 Dec 2020 15:36:28 +0000 (10:36 -0500)
committerZack Weinberg <zackw@panix.com>
Tue, 8 Dec 2020 15:36:28 +0000 (10:36 -0500)
1. To insulate the test suite from a system-provided config.site file,
set the CONFIG_SITE environment variable to a file that is known not
to exist.  Problem reported by Jannick.

2. AC_PROG_CC, AC_PROG_CXX, AC_PROG_CPP, and AC_PROG_CXXCPP may set
cache variables named ‘ac_cv_prog_$tool’ or ‘ac_cv_prog_ac_ct_$tool’,
depending on system conditions; _AT_CONFIG_CMP_PRUNE needs to handle
both possibilities.  Found by testing on FreeBSD 12; I have no idea
why it didn’t show up on _any_ of my other test platforms.

3. The ‘AC_PROG_LEX with yywrap’ test needs to be skipped on systems
that don’t provide libl.a nor libfl.a.  This change needed yet another
hook for AT_CHECK_MACRO.  Found by testing on Alpine Linux.

(Ideally, instead of skipping this test, we would test that this
configure script *errors out* on these systems, but that would involve
much more invasive changes to AT_CHECK_MACRO, which I don’t want to
hold the release for.)

* tests/local.at (AT_PREPARE_TESTS): Set CONFIG_SITE to refer to
  a file that is known not to exist, and export it.
  (_AT_CONFIG_CMP_PRUNE): Prune all variables matching the
  ERE ‘ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)’.
  (AT_CHECK_MACRO): Add PRETEST-CMDS argument which takes commands to
  execute immediately after AT_SETUP.
* tests/semantics.at (AC_PROG_LEX with yywrap): Using PRETEST-CMDS,
  skip this test on OSes where neither -ll nor -lfl provides a
  definition of yywrap.

tests/local.at
tests/semantics.at

index cda8db805935ebc52a84f583ba2c712e3e46ca5a..6062bcfad266a3ac2ae7e00ddd3e544d5eb62588 100644 (file)
@@ -29,11 +29,17 @@ AT_COLOR_TESTS
 
 # Sanitize the environment used for tests.
 AT_PREPARE_TESTS(
-[# These variables should not be inherited from the
-# parent environment.
-AS_UNSET([CONFIG_SITE])
+[# MAKEFLAGS should not be inherited from the parent environment.
 AS_UNSET([MAKEFLAGS])
 
+# We do not want to read any external config.site file.
+# If CONFIG_SITE is not set, autoconf will look for config.site in
+# $prefix/share and $prefix/etc.
+AS_IF([test -e nonexistent],
+  [AS_ERROR([something named 'nonexistent' exists in the test directory])])
+CONFIG_SITE=`pwd`/nonexistent/config.site
+export CONFIG_SITE
+
 # Ensure MAKE is set to a useful value.  Unlike the above, we *do*
 # want to inherit this variable from the parent environment and/or
 # our command line.
@@ -445,8 +451,8 @@ fi
 #     - ac_cv_env_(any of the above)_(set|value)
 #     - ac_cv_c_compiler_gnu, ac_cv_cxx_compiler_gnu
 #     - ac_cv_c_decl_report, ac_cv_cxx_decl_report
-#     - ac_cv_prog_c_*, ac_cv_prog_cxx_*, ac_cv_prog_ac_ct_(CC|CXX)
-#     - ac_cv_prog_CPP, ac_cv_prog_CXXCPP
+#     - ac_cv_prog_c_*, ac_cv_prog_cxx_*,
+#     - ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)
 #     + other ac_cv_c_* are renamed to ac_cv_cxx_*
 #     + OPENMP_CFLAGS is renamed to OPENMP_CXXFLAGS
 #   vary:NAME (where NAME is any identifier): ignore ac_cv_NAME
@@ -527,10 +533,14 @@ m4_define([_AT_CONFIG_CMP_PRUNE],
        /^ac_cv_env_CXXFLAGS_value=/ d
        /^ac_cv_env_GXX_set=/ d
        /^ac_cv_env_GXX_value=/ d
-       /^ac_cv_prog_ac_ct_CC=/ d
-       /^ac_cv_prog_ac_ct_CXX=/ d
+       /^ac_cv_prog_CC=/ d
+       /^ac_cv_prog_CXX=/ d
        /^ac_cv_prog_CPP=/ d
        /^ac_cv_prog_CXXCPP=/ d
+       /^ac_cv_prog_ac_ct_CC=/ d
+       /^ac_cv_prog_ac_ct_CXX=/ d
+       /^ac_cv_prog_ac_ct_CPP=/ d
+       /^ac_cv_prog_ac_ct_CXXCPP=/ d
        /^ac_cv_c_compiler_gnu=/ d
        /^ac_cv_cxx_compiler_gnu=/ d
        /^ac_cv_c_decl_report=/ d
@@ -681,7 +691,7 @@ AT_CLEANUP
 ])
 
 # AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
-#                [AUTOCONF-FLAGS], [TEST-PARAMETERS])
+#                [AUTOCONF-FLAGS], [TEST-PARAMETERS], [PRETEST-CMDS])
 # -----------------------------------------------------
 # Create a minimalist configure.ac running the macro named MACRO
 # (using the code in MACRO-USE if that argument is not empty,
@@ -707,6 +717,10 @@ AT_CLEANUP
 # If ADDITIONAL-CMDS are present, they are executed after the first
 # pair of tests (with the C compiler, in native mode).
 #
+# If PRETEST-CMDS are present, they are executed immediately after
+# AT_SETUP; use this if the test needs to be skipped conditionally,
+# for example.
+#
 # If TEST-PARAMETERS are present, they should be a space-separated
 # list of modifiers to how the test is carried out.  Currently
 # the following modifiers are defined:
@@ -723,6 +737,7 @@ AT_CLEANUP
 #     may legitimately vary between the C tests and the C++ tests.
 m4_define([AT_CHECK_MACRO],
 [AT_SETUP([$1])
+m4_n([$6])dnl
 
 # C compiler, native mode.
 AT_CONFIGURE_AC([m4_default([$2], [$1])])
index e6c7cf20da960e5e226620797e8c3e77c16f07eb..ac7fe013a6a30bf62e2ebd9aa6f0642225e65ae8 100644 (file)
@@ -1250,9 +1250,23 @@ AT_CLEANUP
 # their paces as much as the autogenerated AT_CHECK_MACRO invocation
 # used to, back when AC_PROG_LEX took no arguments.
 
-AT_CHECK_MACRO([AC_PROG_LEX with yywrap], [AC_PROG_LEX([yywrap])])
 AT_CHECK_MACRO([AC_PROG_LEX with noyywrap], [AC_PROG_LEX([noyywrap])])
 
+AT_CHECK_MACRO([AC_PROG_LEX with yywrap], [AC_PROG_LEX([yywrap])],
+               [], [], [],
+[# Skip this test on OSes where there is no -ll nor -lfl.
+
+AT_DATA([configure.ac],
+[[AC_INIT([lexlib-probe], [1])
+AC_PROG_CC
+AC_SEARCH_LIBS([yywrap], [l fl], [], [AS_EXIT(77)])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+])
+
+
 AT_SETUP([AC_PROG_LEX in legacy mode])
 
 AT_CONFIGURE_AC([[AC_PROG_LEX]])