summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-01-13 22:39:47 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-01-16 18:33:35 +0100
commit8fec2399264ee4822ecf2c0d9275d890edbc8e50 (patch)
tree20e8c69dbafc97be818ea222a54d8343f3d4b1d6
parentd9a7182ed15654aebdd049857282106e84962813 (diff)
downloadautomake-8fec2399264ee4822ecf2c0d9275d890edbc8e50.tar.gz
recheck: fix interaction with "make -n"
* lib/am/check.am (recheck): Ensure the recipe does not erroneously remove '.log' files when running under "make -n". For the sake of NetBSD make, this also means that ... (.MAKE): ... this cannot depend on 'recheck' anymore. * tests/parallel-tests-dryrun.test: New test. * tests/list-of-tests.mk: Add it.
-rw-r--r--lib/am/check.am9
-rw-r--r--tests/list-of-tests.mk1
-rwxr-xr-xtests/parallel-tests-dryrun.test93
3 files changed, 100 insertions, 3 deletions
diff --git a/lib/am/check.am b/lib/am/check.am
index 47561ae6d..e0a453b32 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -272,8 +272,12 @@ check-TESTS recheck:
done; \
## Under "make recheck", remove the logs of the files to recheck, so that
## those will be rerun by the "make test-suite.log" recursive invocation
-## below.
- test $@ != recheck || test -z "$$list" || rm -f $$list || exit 1; \
+## below. But use a proper hack to avoid extra files removal when running
+## under "make -n".
+ if test $@ = recheck && test -n "$$list"; then \
+ echo "am--clean: ; rm -f $$list" \
+ | $(MAKE) $(AM_MAKEFLAGS) -f - am--clean || exit 1; \
+ fi; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list"
## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
@@ -282,7 +286,6 @@ recheck: %CHECK_DEPS%
AM_RECURSIVE_TARGETS += check recheck
.PHONY: recheck
-.MAKE: recheck
## ----------------------------------------------- ##
## Produce HTML. To be removed in automake 1.12. ##
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 9d95e1858..e88ad1a4d 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -617,6 +617,7 @@ parallel-tests7.test \
parallel-tests8.test \
parallel-tests9.test \
parallel-tests10.test \
+parallel-tests-dryrun.test \
parallel-tests-harderror.test \
parallel-tests-unreadable-log.test \
parallel-tests-subdir.test \
diff --git a/tests/parallel-tests-dryrun.test b/tests/parallel-tests-dryrun.test
new file mode 100755
index 000000000..c79a29386
--- /dev/null
+++ b/tests/parallel-tests-dryrun.test
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2012 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 parallel-tests interactions with "make -n".
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+TESTS = foo.test bar.test
+$(TESTS):
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+# Avoid confusion with test logs.
+rm -f config.log
+
+log_files='test-suite.log foo.log bar.log'
+html_files='test-suite.html foo.html bar.html'
+the_files="$log_files $html_files"
+
+all_exist ()
+{
+ st=0
+ for i in $*; do
+ test -f $i || { echo File $i not found; st=1; }
+ done
+ test $st -eq 0
+}
+
+none_exist ()
+{
+ st=0
+ for i in $*; do
+ { test -r $i || test -f $i; } && { echo File $i found; st=1; }
+ done
+ test $st -eq 0
+}
+
+for targ in check recheck check-html recheck-html $the_files; do
+ $MAKE -n "$targ"
+ none_exist $the_files
+done
+
+touch $the_files
+
+$MAKE -n mostlyclean
+all_exist $the_files
+$MAKE -n clean
+all_exist $the_files
+
+cat > foo.test <<'END'
+#! /bin/sh
+exit 0
+END
+
+cat > bar.test <<'END'
+#! /bin/sh
+exit 1
+END
+
+chmod a+x foo.test bar.test
+
+$MAKE check && Exit 1
+
+for targ in recheck recheck-html clean mostlyclean distclean; do
+ $MAKE -n "$targ"
+ all_exist $the_files
+done
+
+: