]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Reduce testsuite size.
authorEric Blake <ebb9@byu.net>
Mon, 30 Mar 2009 23:27:45 +0000 (17:27 -0600)
committerEric Blake <ebb9@byu.net>
Tue, 7 Apr 2009 02:58:35 +0000 (20:58 -0600)
* tests/statesave.m4: New file.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
* tests/local.at (AT_CONFIGURE_AC): Reuse file, rather than
repeating inline definition of AC_STATE_SAVE.
(AT_CHECK_ENV): Factor code...
(_AT_CHECK_ENV): ...into shell function.
* tests/m4sh.at (AT_DATA_LINENO): Avoid churn in testsuite.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
tests/Makefile.am
tests/local.at
tests/m4sh.at
tests/statesave.m4 [new file with mode: 0644]

index 4310b2656d50180f304de8ce65229788eb26f161..4c0e3f832a47d08b5f26dd75d7cade08d43069e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-04-06  Eric Blake  <ebb9@byu.net>
 
+       Reduce testsuite size.
+       * tests/statesave.m4: New file.
+       * tests/Makefile.am (EXTRA_DIST): Distribute it.
+       * tests/local.at (AT_CONFIGURE_AC): Reuse file, rather than
+       repeating inline definition of AC_STATE_SAVE.
+       (AT_CHECK_ENV): Factor code...
+       (_AT_CHECK_ENV): ...into shell function.
+       * tests/m4sh.at (AT_DATA_LINENO): Avoid churn in testsuite.
+
        Handle shell comments in AT_CHECK.
        * lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): Handle # in
        test correctly.  Latent bug in handling shell comment was first
index 522236da5e68f8e09861de9794bdcc009cfde3fd..f07c553f4136f37c87da6c66496fcd18836aa48e 100644 (file)
@@ -21,7 +21,7 @@
 # But if you are borrowing from this file for setting up autotest in your
 # project, remember to distribute both testsuite and package.m4.
 EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
-            atlocal.in wrapper.as
+            atlocal.in wrapper.as statesave.m4
 
 # Running the uninstalled scripts.  Build them upon `all', for the manpages.
 noinst_SCRIPTS = $(wrappers)
index fd451d1fcbe86091ddc0746eac3520721e2546f8..9beea3ac558c7a1b3dd3deea0e0031d7e6382584 100644 (file)
@@ -189,37 +189,7 @@ m4_define([AT_DATA_AUTOCONF],
 # Create a full configure.ac running BODY, with a config header set up,
 # AC_OUTPUT, and environment checking hooks.
 m4_define([AT_CONFIGURE_AC],
-[AT_DATA_AUTOCONF([aclocal.m4],
-[[
-# AC_STATE_SAVE(FILE)
-# -------------------
-# Save the shell variables and directory listing.  AT_CHECK_ENV uses these to
-# confirm that no test modifies variables outside the Autoconf namespace or
-# leaves temporary files.  AT_CONFIG_CMP uses the variable dumps to confirm that
-# tests have the same side effects regardless of caching.
-#
-# The sed script duplicates uniq functionality (thanks to 'info sed
-# uniq' for the recipe), in order to avoid a MacOS 10.5 bug where
-# readdir can list a file multiple times in a rapidly changing
-# directory, while avoiding yet another fork.
-m4_defun([AC_STATE_SAVE],
-[(set) 2>&1 | sort >state-env.$][1
-ls | sed '/^at-/d;/^state-/d;/^config\./d
-  h
-  :b
-  $b
-  N
-  /^\(.*\)\n\1$/ {
-    g
-    bb
-  }
-  $b
-  P
-  D' >state-ls.$][1
-])# AC_STATE_SAVE
-]])
-
-AT_DATA([configure.ac],
+[AT_DATA([configure.ac],
 [[AC_INIT
 AC_CONFIG_HEADERS(config.h:config.hin)
 AC_STATE_SAVE(before)]
@@ -230,6 +200,7 @@ AC_STATE_SAVE(after)
 cp "$abs_top_srcdir/build-aux/install-sh" \
    "$abs_top_srcdir/build-aux/config.guess" \
    "$abs_top_srcdir/build-aux/config.sub" .
+cp "$abs_top_srcdir/tests/statesave.m4" aclocal.m4
 ])# AT_CONFIGURE_AC
 
 
@@ -303,10 +274,19 @@ m4_define([AT_CHECK_CONFIGURE],
 #      | '$'=6908
 #
 m4_define([AT_CHECK_ENV],
-[# Compare directory listings.
+[m4_divert_once([PREPARE_TESTS], [_AT_CHECK_ENV])dnl
+AT_CHECK([at_check_env])])
+m4_define([_AT_CHECK_ENV],
+[AS_FUNCTION_DESCRIBE([at_check_env], [],
+[Compare the directory and environment state both before and after a run,
+and return non-zero status if they differ inappropriately.])
+at_check_env ()
+{
+# Compare directory listings.
 test -f state-ls.before ||
   AS_ERROR([state-ls.before not present])
-test -f state-ls.after && { AT_CMP([state-ls.before], [state-ls.after]) }
+test -f state-ls.after \
+  && { $at_diff state-ls.before state-ls.after || return 1; }
 # Compare variable space dumps.
 if test -f state-env.before && test -f state-env.after; then
   for act_file in state-env.before state-env.after
@@ -336,9 +316,9 @@ if test -f state-env.before && test -f state-env.after; then
       # There may be variables spread on several lines; remove latter lines.
       $GREP '^m4_defn([m4_re_word])=' >clean-$act_file
   done
-  AT_CMP([clean-state-env.before], [clean-state-env.after])
+  $at_diff clean-state-env.before clean-state-env.after
 fi
-])
+} [#]at_check_env])
 
 
 # AT_CONFIG_CMP(VAR-FILE-A, VAR-FILE-B)
index 3664a3d595fd9df05b784ceccf4c2491c076d6d5..def63aa9ea0bdd967a27aa267931ad18b025ae46 100644 (file)
@@ -2,8 +2,8 @@
 
 AT_BANNER([M4sh.])
 
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+# 2009 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ grep 'Line: .*$4' "$[0]" >/dev/null ||
   AS@&t@_ERROR([cannot find original script])
 exit 0
 ]])
-# If occurrences of $LINENO or __oline__ were wanted, create them.
+# If occurrences of $LINENO or __@&t@oline__ were wanted, create them.
 sed 's/__LINENO__/$''LINENO/g;s/__OLINE__/__''oline__/g' $1.tas >$1.as
 AT_CHECK([autom4te -l m4sh $1.as -o $1])
 ])# AT_DATA_LINENO
diff --git a/tests/statesave.m4 b/tests/statesave.m4
new file mode 100644 (file)
index 0000000..30cedc2
--- /dev/null
@@ -0,0 +1,34 @@
+# statesave.m4 serial 1
+
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+# 2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AC_STATE_SAVE(FILE)
+# -------------------
+# Save the shell variables and directory listing.  AT_CHECK_ENV uses these to
+# confirm that no test modifies variables outside the Autoconf namespace or
+# leaves temporary files.  AT_CONFIG_CMP uses the variable dumps to confirm
+# that tests have the same side effects regardless of caching.
+#
+# The sed script duplicates uniq functionality (thanks to 'info sed
+# uniq' for the recipe), in order to avoid a MacOS 10.5 bug where
+# readdir can list a file multiple times in a rapidly changing
+# directory, while avoiding yet another fork.
+m4_defun([AC_STATE_SAVE],
+[(set) 2>&1 | sort >state-env.$1
+ls | sed '/^at-/d;/^state-/d;/^config\./d
+  h
+  :b
+  $b
+  N
+  /^\(.*\)\n\1$/ {
+    g
+    bb
+  }
+  $b
+  P
+  D' >state-ls.$1
+])# AC_STATE_SAVE