automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] {maint} recheck: fix interaction with "make -n"


From: Stefano Lattarini
Subject: [PATCH 4/4] {maint} recheck: fix interaction with "make -n"
Date: Fri, 13 Jan 2012 22:46:09 +0100

* lib/am/check.am (recheck): Ensure the recipe does not erroneously
remove '.log' files when running under "make -n".
* tests/parallel-tests-dryrun.test: New test.
* tests/Makefile.am (TESTS): Add it.
---
 lib/am/check.am                  |    8 +++-
 tests/Makefile.am                |    1 +
 tests/parallel-tests-dryrun.test |   93 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 2 deletions(-)
 create mode 100755 tests/parallel-tests-dryrun.test

diff --git a/lib/am/check.am b/lib/am/check.am
index 47561ae..ad51310 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.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9db0a03..92fe8b0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -646,6 +646,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 0000000..fc6aff9
--- /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
+
+:
-- 
1.7.7.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]