autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

15-classified-tests.patch


From: Akim Demaille
Subject: 15-classified-tests.patch
Date: Sun, 21 Jan 2001 17:59:15 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * tests/atgeneral.m4 (AT_INIT): Include a default case for non
        existing tests.
        * tests/atspecific.m4 (AT_CONFIGURE_AC, AT_CHECK_ENV)
        (AT_CHECK_AUTOUPDATE, AT_CHECK_AU_MACRO): New.
        Spread their use.
        (AT_CHECK_MACRO): Pass `-W obsolete' to autoconf.
        * tests/semantics.at (AC_HAVE_FUNCS): Obsolete, don't check.
        * tests/mktest.sh: Create one test file per Autoconf source
        file instead of separating syntax/update.
        
        
Index: tests/Makefile.am
--- tests/Makefile.am Fri, 12 Jan 2001 22:21:56 +0100 akim (ace/b/17_Makefile.a 
1.39 666)
+++ tests/Makefile.am Sun, 21 Jan 2001 16:11:14 +0100 akim (ace/b/17_Makefile.a 
1.39 666)
@@ -22,8 +22,9 @@
 
 SUITE = suite.at \
         m4sugar.at m4sh.at \
-        base.at tools.at torture.at compile.at semantics.at syntax.at \
-       update.at foreign.at
+        base.at tools.at torture.at compile.at semantics.at \
+       acgeneral.at acspecific.at acfunctions.at aclang.at acheaders.at
+       foreign.at
 
 # We don't actually distribute the testsuite, since one only
 # needs m4 to build it, m4 being required anyway to install Autoconf.
@@ -45,13 +46,25 @@
 
 
 # The files which contains macro we check for syntax.
-MACRO_FILES = ../acgeneral.m4   ../acspecific.m4 \
-              ../acfunctions.m4 ../aclang.m4 ../acheaders.m4
+MACRO_FILES = $(top_srcdir)/acgeneral.m4 \
+              $(top_srcdir)/acspecific.m4 \
+              $(top_srcdir)/acfunctions.m4 \
+              $(top_srcdir)/aclang.m4 \
+              $(top_srcdir)/acheaders.m4
 
-syntax.at: mktests.sh $(MACRO_FILES)
+acgeneral.at: mktests.sh $(MACRO_FILES)
        cd $(srcdir) && ./mktests.sh $(MACRO_FILES)
 
-update.at: mktests.sh $(MACRO_FILES)
+acspecific.at: mktests.sh $(MACRO_FILES)
+       cd $(srcdir) && ./mktests.sh $(MACRO_FILES)
+
+acfunctions.at: mktests.sh $(MACRO_FILES)
+       cd $(srcdir) && ./mktests.sh $(MACRO_FILES)
+
+aclang.at: mktests.sh $(MACRO_FILES)
+       cd $(srcdir) && ./mktests.sh $(MACRO_FILES)
+
+acheaders.at: mktests.sh $(MACRO_FILES)
        cd $(srcdir) && ./mktests.sh $(MACRO_FILES)
 
 CLEANFILES = debug-*.sh macro configure configure.in configure.ac \
Index: tests/atgeneral.m4
--- tests/atgeneral.m4 Sun, 21 Jan 2001 14:23:42 +0100 akim 
(ace/b/19_atgeneral. 1.53 644)
+++ tests/atgeneral.m4 Sun, 21 Jan 2001 15:25:02 +0100 akim 
(ace/b/19_atgeneral. 1.53 644)
@@ -218,6 +218,11 @@ m4_define([AT_data_files],
   case $at_test in
 dnl Tests inserted here (TESTS).
 m4_divert([TAIL])[]dnl
+
+  * )
+    echo $as_me: no such test: $at_test
+    continue
+    ;;
   esac
   case $at_test in
     banner-*) ;;
Index: tests/atspecific.m4
--- tests/atspecific.m4 Fri, 19 Jan 2001 20:59:30 +0100 akim 
(ace/b/24_atspecific 1.32 644)
+++ tests/atspecific.m4 Sun, 21 Jan 2001 15:22:58 +0100 akim 
(ace/b/24_atspecific 1.32 644)
@@ -22,6 +22,23 @@
 ## ---------------------------------------- ##
 
 
+# AT_CONFIGURE_AC(BODY)
+# ---------------------
+# Create a full configure.ac running BODY, with a config header set up,
+# AC_OUTPUT, and environement checking hooks.
+m4_define([AT_CONFIGURE_AC],
+[AT_CLEANUP_FILES(env-after state*)dnl
+AT_DATA([configure.ac],
+[AC_INIT
+AC_CONFIG_AUX_DIR($top_srcdir)
+AC_CONFIG_HEADER(config.h:config.hin)
+AC_STATE_SAVE(before)
+$1
+AC_STATE_SAVE(after)
+AC_OUTPUT
+])])
+
+
 # AT_CHECK_AUTOCONF(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)
 # -----------------------------------------------------------
 # Also remove `configure.in', just in case one remained from a previous
@@ -55,6 +72,43 @@ m4_define([AT_CHECK_CONFIGURE],
          [test $at_verbose = echo && echo "$srcdir/AT_LINE: config.log" && cat 
config.log])])
 
 
+# AT_CHECK_ENV
+# ------------
+# Check that the full configure run remained in its variable name space,
+# and cleaned up tmp files.
+# me tests might exit prematurely when they find a problem, in
+# which case `env-after' is probably missing.  Don't check it then.
+m4_define([AT_CHECK_ENV],
+[if test -f state-env.before -a -f state-env.after; then
+  mv -f state-env.before expout
+  AT_CHECK([cat state-env.after], 0, expout)
+fi
+if test -f state-ls.before -a -f state-ls.after; then
+  mv -f state-ls.before expout
+  AT_CHECK([cat state-ls.after], 0, expout)
+fi
+])
+
+
+# AT_CHECK_DEFINES(CONTENT)
+# -------------------------
+# Verify that config.h, once stripped is CONTENT.
+# Stripping consists of keeping CPP lines (i.e. containing a hash),
+# but those of automatically checked features (STDC_HEADERS etc.).
+# AT_CHECK_HEADER is a better name, but too close from AC_CHECK_HEADER.
+m4_define([AT_CHECK_DEFINES],
+[AT_CHECK([[fgrep '#' config.h |
+   egrep -v 'STDC_HEADERS|STDLIB|INTTYPES|MEMORY|STRING|UNISTD']],, [$1])])
+
+
+# AT_CHECK_AUTOUPDATE
+# -------------------
+m4_define([AT_CHECK_AUTOUPDATE],
+[AT_CHECK([autoupdate --autoconf-dir $at_top_srcdir], 0,
+          [], [autoupdate: `configure.ac' is updated
+])])
+
+
 # _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS)
 # --------------------------------------
 # Create a minimalist configure.ac running the macro named
@@ -63,76 +117,66 @@ m4_define([AT_CHECK_CONFIGURE],
 # TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh',
 # `config.guess' etc.).
 m4_define([_AT_CHECK_AC_MACRO],
-[dnl Produce the configure.ac
-AT_CLEANUP_FILES(env-after state*)dnl
-AT_DATA([configure.ac],
-[AC_INIT
-AC_CONFIG_AUX_DIR($top_srcdir)
-AC_CONFIG_HEADER(config.h:config.hin)
-AC_STATE_SAVE(before)
-$1
-AC_STATE_SAVE(after)
-AC_OUTPUT
-])
+[AT_CONFIGURE_AC([$1])
 $2
 AT_CHECK_AUTOCONF
 AT_CHECK_AUTOHEADER
 AT_CHECK_CONFIGURE
-
-dnl Some tests might exit prematurely when they find a problem, in
-dnl which case `env-after' is probably missing.  Don't check it then.
-if test -f state-env.before -a -f state-env.after; then
-  mv -f state-env.before expout
-  AT_CHECK([cat state-env.after], 0, expout)
-fi
-if test -f state-ls.before -a -f state-ls.after; then
-  mv -f state-ls.before expout
-  AT_CHECK([cat state-ls.after], 0, expout)
-fi
+AT_CHECK_ENV
 ])# _AT_CHECK_AC_MACRO
 
 
-# AT_CHECK_MACRO(NAME-OF-THE-MACRO, [MACRO-USE], [ADDITIONAL-CMDS])
-# -----------------------------------------------------------------
+# AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS])
+# -----------------------------------------------------
 # Create a minimalist configure.ac running the macro named
 # NAME-OF-THE-MACRO, check that autoconf runs on that script,
 # and that the shell runs correctly the configure.
 # TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh',
 # `config.guess' etc.).
+#
+# New macros are not expected to depend upon obsolete macros.
 m4_define([AT_CHECK_MACRO],
 [AT_SETUP([$1])
+AT_CONFIGURE_AC([m4_default([$2], [$1])])
 
-_AT_CHECK_AC_MACRO([m4_default([$2], [$1])])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_ENV
 $3
 AT_CLEANUP()dnl
 ])# AT_CHECK_MACRO
 
 
-# AT_CHECK_UPDATE(NAME-OF-THE-MACRO)
-# ----------------------------------
+# AT_CHECK_AU_MACRO(MACRO)
+# ------------------------
 # Create a minimalist configure.ac running the macro named
 # NAME-OF-THE-MACRO, autoupdate this script, check that autoconf runs
 # on that script, and that the shell runs correctly the configure.
 # TOP_SRCDIR is needed to set the auxdir (some macros need
 # `install-sh', `config.guess' etc.).
-m4_define([AT_CHECK_UPDATE],
-[AT_SETUP([autoupdating $1])
+#
+# Updated configure.ac shall not depend upon obsolete macros, which votes
+# in favor of `-W obsolete', but since many of these macros leave a message
+# to be removed by the user once her code ajusted, let's not check.
+#
+# Remove config.hin to avoid `autoheader: config.hin is unchanged'.
+m4_define([AT_CHECK_AU_MACRO],
+[AT_SETUP([$1])
+AT_CONFIGURE_AC([$1])
 
-_AT_CHECK_AC_MACRO([$1],
-[AT_CHECK([autoupdate --autoconf-dir $at_top_srcdir], 0,
-          [], [autoupdate: `configure.ac' is updated
-])])
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_ENV
 
-AT_CLEANUP()dnl
-])# AT_CHECK_UPDATE
+rm config.hin
+AT_CHECK_AUTOUPDATE
 
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_ENV
 
-# AT_CHECK_DEFINES(CONTENT)
-# -------------------------
-# Verify that config.h, once stripped is CONTENT.
-# Stripping consists of keeping CPP lines (i.e. containing a hash),
-# but those of automatically checked features (STDC_HEADERS etc.).
-# AT_CHECK_HEADER is a better name, but too close from AC_CHECK_HEADER.
-m4_define([AT_CHECK_DEFINES],
-[AT_CHECK([[fgrep '#' config.h |
-   egrep -v 'STDC_HEADERS|STDLIB|INTTYPES|MEMORY|STRING|UNISTD']],, [$1])])
+AT_CLEANUP()dnl
+])# AT_CHECK_UPDATE
Index: tests/mktests.sh
--- tests/mktests.sh Sat, 23 Dec 2000 11:36:46 +0100 akim (ace/b/46_mktests.sh 
1.7 777)
+++ tests/mktests.sh Sun, 21 Jan 2001 16:23:58 +0100 akim (ace/b/46_mktests.sh 
1.7 777)
@@ -21,10 +21,15 @@
 # If we fail, clean up, but touch the output files.  We probably failed
 # because we used some non portable tool, but we just don't care: this
 # shell script is a maintainer tool, and we do expect good tools.
-trap 'echo "'$0': failed.  To proceed run make check." >&2
-      rm -f acdefuns audefuns requires syntax.tat update.tat
-      touch syntax.at
-      touch update.at
+
+as_me=`echo "$0" | sed 's,.*/,,'`
+
+trap 'echo "'"$as_me"': failed.  To proceed run make check." >&2
+      rm -f acdefuns audefuns requires $as_me.tat
+      for file in "$@"
+      do
+        touch `echo "$file" | sed "s,.*/,,;s/\..*/.at/"`
+      done
       trap 0
       exit 1' \
      0 1 2 15
@@ -44,9 +49,21 @@
 export LC_ALL; LC_ALL=C
 
 
+# requires
+# --------
+# Get the list of macros that are required: there is little interest
+# in testing them since they will be run but the guy who requires
+# them.
+cat $src |
+  sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
+  sort |
+  uniq >requires
+
+
 # exclude_list
 # ------------
-# Macros which must not be checked at all (not by syntax.at, not udpate.at).
+# Macros which must not be checked at all (not by ac-macros.at, nor
+# au-macros.at).
 # The trailing new line is meant.
 #
 # - ac_cv_prog_gcc, gxx, g77
@@ -54,18 +71,12 @@
 exclude_list='^ac_cv_prog_(gcc|gxx|g77)$
 '
 
-
-
-## ----------- ##
-## syntax.at.  ##
-## ----------- ##
-
-# syntax_exclude_list
-# -------------------
-# The test `syntax.at' tries to run all the macros of Autoconf to check
+# ac_exclude_list
+# ---------------
+# The test `ac-macros.at' tries to run all the macros of Autoconf to check
 # for syntax problems, etc.  Not all the macros can be run without argument,
 # and some are already tested elsewhere.  EGREP_EXCLUDE must filter out
-# the macros we don't want to test in syntax.at.
+# the macros we don't want to test in ac-macros.at.
 #
 # - AC_CANONICALIZE, AC_PREFIX_PROGRAM, AC_PREREQ
 #   Need an argument.
@@ -96,7 +107,7 @@
 # - AC_PATH_XTRA
 #   Checked in semantics.
 #
-syntax_exclude_list='^AC_ARG_VAR$
+ac_exclude_list='^AC_ARG_VAR$
 ^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
 ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
 ^AC_CONFIG
@@ -118,53 +129,18 @@
 ^AC_PATH_XTRA$
 _AC_'
 
-# syntax_exclude_egrep --
+
+# ac_exclude_egrep
+# ----------------
 # Build a single egrep pattern out of filter_macros_list.
 # Sed is used to get rid of the trailing `|' coming from the trailing
 # `\n' from `echo'.
-syntax_exclude_egrep=`echo "$exclude_list$syntax_exclude_list" | tr '
+ac_exclude_egrep=`echo "$exclude_list$ac_exclude_list" | tr '
 ' '|' | sed 's/.$//'`
 
-sed 's/^ *//' >syntax.tat <<MK_EOF
-# Generated by mktests.sh, do not edit by hand.                -*- autoconf -*-
-
-AT_BANNER([Syntax of macros and completeness of header templates.])
-
-MK_EOF
-
-# Get the list of macros which are defined in Autoconf level.
-# Get rid of the macros we are not interested in.
-cat $src |
-  sed -n -e 's/^A[CU]_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
-         -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
-  sort |
-  uniq |
-  egrep -v "$syntax_exclude_egrep" >acdefuns
-
-# Get the list of macros that are required: there is little interest
-# in testing them since they will be run but the guy who requires
-# them.
-cat $src |
-  sed -ne 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
-  sort |
-  uniq >requires
-
-# Filter out.
-for macro in `cat acdefuns`; do
-  if fgrep "$macro" requires >/dev/null 2>&1; then :; else
-    echo "AT_CHECK_MACRO([$macro])" >>syntax.tat
-  fi
-done
-
-mv syntax.tat syntax.at
 
-
-## ----------- ##
-## update.at.  ##
-## ----------- ##
-
-# update_exclude_list
-# -------------------
+# au_exclude_list
+# ---------------
 # AC_LANG_RESTORE
 #    cannot be used alone.
 # AC_LINK_FILES, AC_PREREQ
@@ -173,38 +149,76 @@
 #    are already in `configure.ac'.
 # AC_CYGWIN, AC_MINGW32, AC_EMXOS2
 #    are using AC_REQUIRE.
-update_exclude_list='^AC_LANG_RESTORE$
+au_exclude_list='^AC_LANG_RESTORE$
 ^AC_LINK_FILES|AC_PREREQ$
 ^AC_(INIT|OUTPUT)$
 ^AC_(CYGWIN|MINGW32|EMXOS2)$'
 
-# syntax_exclude_egrep --
+
+# au_exclude_egrep
+# ----------------
 # Build a single egrep pattern out of filter_macros_list.
 # Sed is used to get rid of the trailing `|' coming from the trailing
 # `\n' from `echo'.
-update_exclude_egrep=`echo "$exclude_list$update_exclude_list" | tr '
+au_exclude_egrep=`echo "$exclude_list$au_exclude_list" | tr '
 ' '|' | sed 's/.$//'`
 
 
-sed 's/^ *//' >update.tat <<MK_EOF
-# Generated by mktests.sh, do not edit by hand.                -*- autoconf -*-
 
-AT_BANNER([Syntax of autoupdated scripts.])
+## ------------------------- ##
+## Creating the test files.  ##
+## ------------------------- ##
+
+for file in $src
+do
+  base=`echo "$file" | sed 's,.*/,,;s/\..*//'`
+  # Get the list of macros which are defined in Autoconf level.
+  # Get rid of the macros we are not interested in.
+  cat $file |
+    sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
+          -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
+    sort |
+    uniq |
+    # Watch out we are `set -e': don't fail.
+    ( egrep -v "$ac_exclude_egrep";: ) >acdefuns
+
+  # Get the list of macros which are defined in Autoupdate level.
+  cat $file |
+    sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
+    sort |
+    uniq |
+    ( egrep -v "$au_exclude_egrep";: ) > audefuns
+
+  # Filter out required macros.
+  {
+    sed 's/^ *//' <<MK_EOF
+    # Generated by $as_me, do not edit by hand.        -*- autoconf -*-
 
-MK_EOF
+    AT_BANNER([Testing $base macros.])
 
-# Get the list of macros which are defined in Autoupdate level.
-cat $src |
-  sed -ne 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
-  sort |
-  uniq |
-  egrep -v "$update_exclude_egrep" |
-  sed 's/.*/AT_CHECK_UPDATE([&])/'  >>update.tat
+MK_EOF
 
-mv update.tat update.at
+    echo "# Modern macros."
+    for macro in `cat acdefuns`; do
+      if fgrep "$macro" requires >/dev/null 2>&1; then :; else
+       echo "AT_CHECK_MACRO([$macro])"
+      fi
+    done
+    echo
+    echo "# Obsolete macros."
+    for macro in `cat audefuns`; do
+      if fgrep "$macro" requires >/dev/null 2>&1; then :; else
+       echo "AT_CHECK_AU_MACRO([$macro])"
+      fi
+    done
+  } >$as_me.tat
+
+  # In one atomic step so that if something above fails, the trap
+  # preserves the old version of the file.
+  mv $as_me.tat $base.at
+done
 
 rm -f acdefuns audefuns requires
 
 trap 0
-
 exit 0
Index: tests/semantics.at
--- tests/semantics.at Fri, 19 Jan 2001 20:59:30 +0100 akim 
(ace/b/25_semantics. 1.36 644)
+++ tests/semantics.at Sun, 21 Jan 2001 15:09:47 +0100 akim 
(ace/b/25_semantics. 1.36 644)
@@ -47,19 +47,6 @@
 ])])
 
 
-# AC_HAVE_FUNCS
-# -------------
-# This macro is an obsolete version of AC_CHECK_FUNCS.  Running this
-# test allows to check that AU_ALIAS'ed macros work properly.
-AT_CHECK_MACRO([AC_HAVE_FUNCS],
-[AC_HAVE_FUNCS(printf autoconf_ftnirp)],
-[AT_CHECK_DEFINES(
-[/* #undef HAVE_AUTOCONF_FTNIRP */
-#define HAVE_PRINTF 1
-])])
-
-
-
 # AC_CHECK_HEADERS
 # ----------------
 # Check that it performs the correct actions:
@@ -72,7 +59,6 @@
 ])])
 
 
-
 # AC_CHECK_MEMBERS
 # ----------------
 # Check that it performs the correct actions.
@@ -128,7 +114,6 @@
 ])])
 
 
-
 # AC_CHECK_TYPES
 # --------------
 # Check that we properly dispatch properly to the old implementation
@@ -165,7 +150,6 @@
 ])
 
 AT_CLEANUP
-
 
 
 # AC_CHECK_FILES
Index: tests/suite.at
--- tests/suite.at Sat, 23 Dec 2000 11:36:46 +0100 akim (ace/b/20_suite.m4 1.22 
664)
+++ tests/suite.at Sun, 21 Jan 2001 16:11:36 +0100 akim (ace/b/20_suite.m4 1.22 
664)
@@ -9,8 +9,8 @@
 AT_INIT([autoconf])
 
 AT_BANNER(
-[Some tests might be ignored if you don't have the software which the
-macros are supposed to test (e.g., a Fortran compiler).])
+[Some tests might be skipped if you don't have the software which the
+macros check (e.g., a Fortran compiler).])
 
 # Run the tests from the lowest level to the highest level, and from
 # the most selective to the easiest.
@@ -41,11 +41,12 @@
 # Checking that AC_CHECK_FOO macros work properly.
 m4_include([semantics.at])
 
-# Checking all the AC_DEFUN'd macros.
-m4_include([syntax.at])
-
-# Checking that updating an obsolete macro produces a valid configure.ac
-m4_include([update.at])
+# Blind testing the macros.
+m4_include([acgeneral.at])
+m4_include([acspecific.at])
+m4_include([acfunctions.at])
+m4_include([aclang.at])
+m4_include([acheaders.at])
 
 # Compatibility with foreign tools.
 m4_include([foreign.at])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]