summaryrefslogtreecommitdiff
path: root/tests/statesave.m4
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-03-30 17:27:45 -0600
committerEric Blake <ebb9@byu.net>2009-04-06 20:58:35 -0600
commit31796ef9892ad6cb7648f4911fd110fa6a6c74cf (patch)
treee64dd26dcc3a74254ca449287e70190748764fc2 /tests/statesave.m4
parentc283f62edb0f6a38f035fe824baa8547a49d2a44 (diff)
downloadautoconf-31796ef9892ad6cb7648f4911fd110fa6a6c74cf.tar.gz
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 <ebb9@byu.net>
Diffstat (limited to 'tests/statesave.m4')
-rw-r--r--tests/statesave.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/statesave.m4 b/tests/statesave.m4
new file mode 100644
index 00000000..30cedc2e
--- /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