-2011-01-23 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-
- tests: avoid instspc.test failures due to make's whitespace trimming
- * tests/instspc.test: Prepend './' when passing the test
- characters, to avoid leading whitespace characters to be trimmed
- from macros set from environment variables. Fixes testsuite
- failures with HP-UX, IRIX, and Tru64/OSF make.
-
+ 2011-01-23 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ coverage: test semantics of "dummy" per-target flags
+ * tests/specflg-dummy.test: New test, ensuring that even "dummy"
+ per-target flags triggers the use of renamed objects.
+ * tests/Makefile.am (TESTS): Update.
+ Suggestion by Ralf Wildenhues.
+
+ 2011-01-23 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ tests defs: sanitize IFS
- * tests/defs.in ($IFS): Define to <space>, <tab>, <newline>.
++ * tests/defs ($IFS): Define to <space>, <tab>, <newline>.
+ ($sp): New variable, holding a single whitespace character.
+ ($tab): New variable, holding a tabulation character.
+ ($nl): New variable, holding a newline character.
+
+2011-01-23 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ tests: avoid instspc* failures due to make's whitespace trimming
+ * tests/instspc-tests.sh: Prepend './' when passing the test
+ characters, to avoid leading whitespace characters to be trimmed
+ from macros set from environment variables. Fixes testsuite
+ failures with HP-UX and Tru64/OSF make.
+
2011-01-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
tests: fix VPATH auto-expansion workarounds.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Defines for Automake testing environment.
-# Tom Tromey <tromey@cygnus.com>
-
-# Be more Bourne compatible.
-# (Snippet copied from configure's initialization in Autoconf 2.64)
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
+## -------------------------------------------------------- ##
+## Source static setup and definitions for the testsuite. ##
+## -------------------------------------------------------- ##
+
+# This code needs to be 'set -e' clean.
+
+# Ensure we are running from the right directory.
+test -f ./defs-static || {
+ echo "$0: ./defs-static: not found in current directory" >&2
+ exit 99
+}
+
+# Source the shell sanitization and variables' definitions.
+. ./defs-static || exit 99
+
+# The name of the current test (without the `.test' suffix.)
+# Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
+me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \
+ && test -n "$me" \
+ || { echo "$argv0: failed to define \$me" >&2; exit 99; }
+
+
+## ---------------------------------------- ##
+## Sanity checks and environment cleanup. ##
+## ---------------------------------------- ##
-# Ensure we are running from the right directory.
-test -f ./defs || {
- echo "defs: not found in current directory" 1>&2
- exit 1
+ # A single whitespace character.
+ sp=' '
+ # A tabulation character.
+ tab=' '
+ # A newline character.
+ nl='
+ '
+
+ # As autoconf-generated configure scripts do, ensure that IFS
+ # is defined initially, so that saving and restoring $IFS works.
+ IFS=$sp$tab$nl
+
+# Ensure $testsrcdir is set correctly.
+test -f "$testsrcdir/defs-static.in" || {
+ echo "$me: $testsrcdir/defs-static.in not found, check \$testsrcdir" >&2
+ exit 99
+}
+
+# Ensure $testbuilddir is set correctly.
+test -f "$testbuilddir/defs-static" || {
+ echo "$me: $testbuilddir/defs-static not found, check \$testbuilddir" >&2
+ exit 99
+}
+
+# Unset some MAKE... variables that may cause $MAKE to act like a
+# recursively invoked sub-make. Any $MAKE invocation in a test is
+# conceptually an independent invocation, not part of the main
+# 'automake' build.
+unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL __MKLVL__ MAKE_JOBS_FIFO
+# Unset verbosity flag.
+unset V
+# Also unset variables that will let `make -e install' divert
+# files into unwanted directories.
+unset DESTDIR
+unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
+unset htmldir includedir infodir libdir libexecdir localedir mandir
+unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
+# The tests call `make -e' but we do not want $srcdir from the environment
+# to override the definition from the Makefile.
+unset srcdir
+# Also unset variables that control our test driver. While not
+# conceptually independent, they cause some changed semantics we
+# need to control (and test for) in some of the tests to ensure
+# backward-compatible behavior.
+unset DISABLE_HARD_ERRORS
+unset TESTS
+unset TEST_LOG_COMPILER
+unset TEST_LOGS
+unset RECHECK_LOGS
+unset VERBOSE
+
+
+## ---------------------------- ##
+## Auxiliary shell functions. ##
+## ---------------------------- ##
+
+# We use a trap below for cleanup. This requires us to go through
+# hoops to get the right exit status transported through the signal.
+# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit ()
+{
+ set +e
+ (exit $1)
+ exit $1
+}
+
+# is_newest FILE FILES
+# --------------------
+# Return false if any file in FILES is newer than FILE.
+# Resolve ties in favor of FILE.
+is_newest ()
+{
+ is_newest_files=`find "$@" -newer "$1"`
+ test -z "$is_newest_files"
}
-if test -z "$srcdir"; then
- # compute $srcdir.
- srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
- test "$srcdir" = $0 && srcdir=.
-else :; fi
+# AUTOMAKE_run status [options...]
+# --------------------------------
+# Run Automake with OPTIONS, and fail if automake
+# does not exit with STATUS.
+AUTOMAKE_run ()
+{
+ expected_exitcode=$1
+ shift
+ exitcode=0
+ $AUTOMAKE ${1+"$@"} >stdout 2>stderr || exitcode=$?
+ cat stderr >&2
+ cat stdout
+ test $exitcode = $expected_exitcode || Exit 1
+}
-# Ensure $srcdir is set correctly.
-test -f "$srcdir/defs.in" || {
- echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
- exit 1
+# AUTOMAKE_fails [options...]
+# ---------------------------
+# Run Automake with OPTIONS, and fail if automake
+# does not exit with STATUS.
+AUTOMAKE_fails ()
+{
+ AUTOMAKE_run 1 ${1+"$@"}
}
-me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
-
-APIVERSION='@APIVERSION@'
-PATH_SEPARATOR='@PATH_SEPARATOR@'
-
-# Make sure we override the user shell.
-SHELL='@SHELL@'
-export SHELL
-# User can override various tools used.
-test -z "$PERL" && PERL='@PERL@'
-test -z "$MAKE" && MAKE=make
-test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@"
-test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@"
-test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
-test -z "$MISSING" && MISSING=`pwd`/../lib/missing
-# Use -Werror because this also turns some Perl warnings into error.
-# (Tests for which this is inappropriate should use -Wno-error.)
-test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror"
-# Extra flags to pass to aclocal before all other flags added by this script.
-ACLOCAL_TESTSUITE_FLAGS=
-export ACLOCAL_TESTSUITE_FLAGS
-
-# See how Automake should be run. We put --foreign as the default
-# strictness to avoid having to create lots and lots of files. A test
-# can override this by specifying a different strictness. Use -Wall
-# -Werror by default. Tests for which this is inappropriate
-# (e.g. when testing that a warning is enabled by a specific switch)
-# should use -Wnone or/and -Wno-error
-test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall"
-
-PATH="`pwd`$PATH_SEPARATOR$PATH"
+
+## ----------------------------------------------------------- ##
+## Checks for required tools, and additional setups (if any) ##
+## required by them. ##
+## ----------------------------------------------------------- ##
+
+# Print it here, so that the user will see it also if the test
+# will be skipped due to some tool missing in $PATH itslef.
echo "$PATH"
-# Some shells forget to export modified environment variables.
-# (See note about `export' in the Autoconf manual.)
-export PATH
+# Look for (and maybe set up) required tools and/or system features; skip
+# the current test if they are not found.
for tool in : $required
do
# Check that each required tool is present.