+2011-08-08 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ test harness: work around a VPATH rewrite issue
+ * lib/am/check.am (am__TEST_BASES): Removed, it's role taken
+ over by ...
+ (am__set_TESTS_bases): ... these new variable.
+ ($(TEST_SUITE_LOG): Use it, to avoid VPATH rewrite issues.
+ * automake.in (handle_tests): Update the code for the cleanup
+ of the `.trs' file to use `$(TEST_LOGS)' instead of
+ `$(am__TEST_BASES)'.
+ * tests/test-harness-vpath-rewrite.test: New test, better
+ exposing the problem fixed by this change
+ * tests/Makefile.am (TESTS): Add it.
+ * tests/test-trs-basic.test: Update and extend.
+
2011-08-07 Stefano Lattarini <stefano.lattarini@gmail.com>
parallel-tests: work around Solaris XPG4 make segfault
}
}
$clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
- $clean_files{'$(am__TEST_BASES:=.trs)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
$clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
$clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN;
}
esac; \
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
-# The names of the tests, with any registered extension removed. Or
-# equivalently, the names of the test logs, with the `.log' extension
-# renoved. This honours runtime overriding of TESTS and TEST_LOGS.
-am__TEST_BASES = $(TEST_LOGS:.log=)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the `.log' extension removed). The result is saved in the shell variable
+# `$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.test'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for f in $$bases; do echo $$f; done | sed 's/\.log//'`; \
+## Trim away any extra whitespace. This has already proved useful in
+## avoiding weird bug on lesser make implementations.
+ bases=`echo $$bases`
# This can be used instead of $(MAKE) in recipes requiring a recursive call
# to make, but which are not intended to be executed by "make -n". See the
## Helper shell function, tells whether a path refers to an existing,
## regular, readable file.
f_ok () { test -f "$$1" && test -r "$$1"; }; \
- bases='$(am__TEST_BASES)'; \
+ $(am__set_TESTS_bases); \
ws='[ ]'; \
## We need to ensures that all the required `.trs' and `.log' files will
## be present and readable. The direct dependencies of $(TEST_SUITE_LOG)
recheck recheck-html:
@ws='[ ]'; \
target=`echo $@ | sed 's,^re,,'`; \
- bases='$(am__TEST_BASES)'; \
+ $(am__set_TESTS_bases); \
list=`for b in $$bases; do \
## Skip tests that haven't been run, but recover gracefully from deleted
## `.trs' files.
test-driver-strip-vpath.test \
test-driver-trs-suffix-registered.test \
test-driver-fail.test \
+test-harness-vpath-rewrite.test \
test-log.test \
test-metadata-global-log.test \
test-metadata-global-result.test \
am__expect_failure=no;; \
esac; \
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
-# The names of the tests, with any registered extension removed. Or
-# equivalently, the names of the test logs, with the `.log' extension
-# renoved. This honours runtime overriding of TESTS and TEST_LOGS.
-am__TEST_BASES = $(TEST_LOGS:.log=)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the `.log' extension removed). The result is saved in the shell variable
+# `$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.test'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for f in $$bases; do echo $$f; done | sed 's/\.log//'`; \
+ bases=`echo $$bases`
# This can be used instead of $(MAKE) in recipes requiring a recursive call
# to make, but which are not intended to be executed by "make -n". See the
# GNU make manual for more details.
test-driver-strip-vpath.test \
test-driver-trs-suffix-registered.test \
test-driver-fail.test \
+test-harness-vpath-rewrite.test \
test-log.test \
test-metadata-global-log.test \
test-metadata-global-result.test \
$(TEST_SUITE_LOG): $(TEST_LOGS)
@$(am__sh_e_setup); $(am__tty_colors); \
f_ok () { test -f "$$1" && test -r "$$1"; }; \
- bases='$(am__TEST_BASES)'; \
+ $(am__set_TESTS_bases); \
ws='[ ]'; \
redo_bases=`for b in $$bases; do \
f_ok $$b.trs && f_ok $$b.log || echo $$b; \
recheck recheck-html:
@ws='[ ]'; \
target=`echo $@ | sed 's,^re,,'`; \
- bases='$(am__TEST_BASES)'; \
+ $(am__set_TESTS_bases); \
list=`for b in $$bases; do \
test -f $$b.trs || test -f $$b.log || continue; \
grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$b.trs \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2010, 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that our concurrent test harness is not subject to spurious VPATH
+# rewrites.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+LOG_COMPILER = true
+empty =
+TESTS = x0 foo bar baz x1
+EXTRA_DIST = $(TESTS)
+END
+
+: > x0
+: > foo
+: > bar
+: > baz
+: > x1
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir build
+cd build
+../configure
+$MAKE check
+test -f test-suite.log
+test -f foo.log
+test -f foo.trs
+test -f bar.log
+test -f bar.trs
+test -f baz.log
+test -f baz.trs
+# We don't want VPATH rewrites, really.
+$MAKE check -n | $EGREP '\.\./(foo|bar|baz)( |$)' && Exit 1
+$MAKE distcheck
+
+:
TEST_LOG_COMPILER = $(SHELL)
SH_LOG_COMPILER = $(SHELL)
-## Used to check some internal details.
+## Used to check some internal details. And yes, the quotes around
+## `$bases' are deliberate: they check for whitespace normalization.
tb:
- echo $(am__TEST_BASES) > $@
+ $(am__set_TESTS_bases); echo "$$bases" > $@
END
cat > foo.test << 'END'
$AUTOCONF
$AUTOMAKE -a
-./configure
#
# Check some internal details first.
#
-$MAKE tb
-test x"`cat tb`" = x"foo bar sub/zardoz"
-rm -f tb
-TESTS='foo.test foo2.sh foo3.exe foo4' $MAKE -e tb
-test x"`cat tb`" = x"foo foo2 foo3.exe foo4"
-rm -f tb
+for vpath in : false; do
+
+ if $vpath; then
+ srcdir=..
+ mkdir build
+ cd build
+ else
+ srcdir=.
+ fi
+
+ $srcdir/configure
+
+ $MAKE tb
+ test x"`cat tb`" = x"foo bar sub/zardoz"
+ rm -f tb
+ # Please don't change the order of the stuff in TESTS, below.
+ TESTS='a foo.test foo2.sh foo3 foo.log foo-log foolog b.exe' $MAKE -e tb
+ test x"`cat tb`" = x"a foo foo2 foo3 foo.log foo-log foolog b.exe"
+ rm -f tb
+
+ cd $srcdir
+
+done
#
# The `test-suite.stamp' file and the `.trs' files get created by