[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
testsuite size (was: zsh variables)
From: |
Eric Blake |
Subject: |
testsuite size (was: zsh variables) |
Date: |
Mon, 6 Apr 2009 17:45:23 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
> > One fix could be to just ignore those two variables in AT_CHECK_ENV.
>
> Good idea. I'm pushing this. I'm also looking at a way to make
> autoconf's testsuite much smaller, by factoring AT_CHECK_ENV and
> AC_SAVE_STATE into reused contents rather than repeatedly emitting them.
This patch is my promised size reduction. Autoconf's testsuite shrinks from
2.7meg to 2.0, or 23% savings. I didn't benchmark to see if the smaller size
leads to faster testsuite generation or execution, but this patch is still
worthwhile.
From: Eric Blake <address@hidden>
Date: Mon, 30 Mar 2009 17:27:45 -0600
Subject: [PATCH] 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.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 9 +++++++++
tests/Makefile.am | 2 +-
tests/local.at | 50 +++++++++++++++-----------------------------------
tests/m4sh.at | 6 +++---
tests/statesave.m4 | 34 ++++++++++++++++++++++++++++++++++
5 files changed, 62 insertions(+), 39 deletions(-)
create mode 100644 tests/statesave.m4
diff --git a/ChangeLog b/ChangeLog
index fba76ad..cce5767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-04-06 Eric Blake <address@hidden>
+ 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.
+
Hard fail any test with syntax errors.
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_postprocess>:
Guarantee test failure on syntax error, rather than inheriting
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 522236d..f07c553 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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)
diff --git a/tests/local.at b/tests/local.at
index fd451d1..9beea3a 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -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)
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 3664a3d..def63aa 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -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@&address@hidden([cannot find original script])
exit 0
]])
-# If occurrences of $LINENO or __oline__ were wanted, create them.
+# If occurrences of $LINENO or __@&address@hidden 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
index 0000000..f65bbb1
--- /dev/null
+++ b/tests/statesave.m4
@@ -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
--
1.6.1.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- testsuite size (was: zsh variables),
Eric Blake <=