autoconf/tests/statesave.m4
Eric Blake 31796ef989 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>
2009-04-06 20:58:35 -06:00

35 lines
1.1 KiB
Plaintext

# 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