[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {test-protocols} test harness: "make -n check" works correctly wit
From: |
Stefano Lattarini |
Subject: |
[FYI] {test-protocols} test harness: "make -n check" works correctly with Solaris make |
Date: |
Mon, 8 Aug 2011 12:53:19 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
To avoid some recipes being executed with "make -n", we used the
trick of issuing recursive make calls not directly with $(MAKE),
but with a simple indirection instead:
...
am__stealth_MAKE = $(MAKE)
...
target:
... $(am__stealth_MAKE) ...
...
This hack worked with GNU make, but, unfortunately, not with
Solaris make. The present change removes the hack, and uses more
proper idioms to avoid unwanted recipe executions with "make -n".
Bug exposed by test case `parallel-tests-dry-run.test'.
* lib/am/check.am (am__stealth_MAKE): Remove, no more used.
(.log.trs): Break recipe in multiple shell invocations.
($(TEST_SUITE_LOG)): Likewise, and move some corner-case parts of
the recipe to ...
(am--redo-logs): ... this new internal helper .PHONY target.
---
ChangeLog | 22 ++++++++++++++
lib/Automake/tests/Makefile.in | 59 ++++++++++++++++++++----------------
lib/am/check.am | 62 ++++++++++++++++++++++----------------
tests/Makefile.in | 64 ++++++++++++++++++++++-----------------
4 files changed, 127 insertions(+), 80 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96cf400..9d34453 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2011-08-08 Stefano Lattarini <address@hidden>
+ test harness: "make -n check" works correctly with Solaris make
+ To avoid some recipes being executed with "make -n", we used the
+ trick of issuing recursive make calls not directly with $(MAKE),
+ but with a simple indirection instead:
+ ...
+ am__stealth_MAKE = $(MAKE)
+ ...
+ target:
+ ... $(am__stealth_MAKE) ...
+ ...
+ This hack worked with GNU make, but, unfortunately, not with
+ Solaris make. The present change removes the hack, and uses more
+ proper idioms to avoid unwanted recipe executions with "make -n".
+ Bug exposed by test case `parallel-tests-dry-run.test'.
+ * lib/am/check.am (am__stealth_MAKE): Remove, no more used.
+ (.log.trs): Break recipe in multiple shell invocations.
+ ($(TEST_SUITE_LOG)): Likewise, and move some corner-case parts of
+ the recipe to ...
+ (am--redo-logs): ... this new internal helper .PHONY target.
+
+2011-08-08 Stefano Lattarini <address@hidden>
+
tests: fix spurious failure with Solaris make
* tests/distcheck-configure-flags-am.test: Avoid using `+=' too
liberally with AM_DISTCHECK_CONFIGURE_FLAGS, since the line breaks
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 7825d10..3d11fc5 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -166,10 +166,6 @@ 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.
-am__stealth_MAKE = $(MAKE)
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check check-html recheck recheck-html
TEST_SUITE_LOG = test-suite.log
@@ -344,9 +340,30 @@ cscope cscopelist:
# Recover from deleted `.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run `foo.test', and re-create
-# both `foo.log' and `foo.trs'.
+# both `foo.log' and `foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
.log.trs:
- rm -f $< $@ && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $<
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Helper recipe used by $(TEST_SUITE_LOG) below, to avoid problems with
+# "make -n". Break this recipe in multiple shell invocations too, to
+# really work as expected with "make -n".
+am--redo-logs:
+ @rm -f $$redo_logs
+ @rm -f $$redo_results
+ @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+ @st=0; \
+ for b in $$redo_bases; do \
+ for e in trs log; do \
+ if test ! -f $$b.$$e || test ! -r $$b.$$e; then \
+ echo "fatal: making $(TEST_SUITE_LOG): failed to create" \
+ "$$b.$$e" >&2; \
+ st=1; \
+ fi; \
+ done; \
+ done; \
+ test $$st -eq 0
$(TEST_SUITE_LOG): $(TEST_LOGS)
@$(am__sh_e_setup); $(am__tty_colors); \
@@ -359,19 +376,9 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
if test -n "$$redo_bases"; then \
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
- rm -f $$redo_logs && rm -f $$redo_results \
- && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ (export redo_bases redo_logs redo_results \
+ && $(MAKE) am--redo-logs) || exit 1; \
fi; \
- st=0; \
- for b in $$redo_bases; do \
- for e in trs log; do \
- f_ok $$b.$$e || { \
- echo "fatal: making $@: failed to create $$b.$$e" >&2; \
- st=1; \
- }; \
- done; \
- done; \
- test $$st -eq 0 || exit 1; \
results=`for b in $$bases; do echo $$b.trs; done`; \
test -n "$$results" || results=/dev/null; \
all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
@@ -650,14 +657,14 @@ uninstall-am:
.MAKE: check-am check-html install-am install-strip recheck \
recheck-html
-.PHONY: all all-am check check-TESTS check-am check-html clean \
- clean-generic distclean distclean-generic distdir dvi dvi-am \
- html html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+.PHONY: all all-am am--redo-logs check check-TESTS check-am check-html \
+ clean clean-generic distclean distclean-generic distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am recheck recheck-html uninstall uninstall-am
diff --git a/lib/am/check.am b/lib/am/check.am
index a6dcc30..d1daac6 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -118,24 +118,42 @@ am__set_TESTS_bases = \
## 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
-# GNU make manual for more details.
-am__stealth_MAKE = $(MAKE)
-
# Recover from deleted `.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run `foo.test', and re-create
-# both `foo.log' and `foo.trs'.
+# both `foo.log' and `foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
.log.trs:
- rm -f $< $@ && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $<
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Helper recipe used by $(TEST_SUITE_LOG) below, to avoid problems with
+# "make -n". Break this recipe in multiple shell invocations too, to
+# really work as expected with "make -n".
+am--redo-logs:
+ @rm -f $$redo_logs
+ @rm -f $$redo_results
+ @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+## Sanity check: each unreadable or non-existent test result file should
+## has been properly remade at this point, as should the corresponding log
+## file.
+ @st=0; \
+ for b in $$redo_bases; do \
+ for e in trs log; do \
+ if test ! -f $$b.$$e || test ! -r $$b.$$e; then \
+ echo "fatal: making $(TEST_SUITE_LOG): failed to create" \
+ "$$b.$$e" >&2; \
+ st=1; \
+ fi; \
+ done; \
+ done; \
+ test $$st -eq 0
+.PHONY: am--redo-logs
$(TEST_SUITE_LOG): $(TEST_LOGS)
- @$(am__sh_e_setup); $(am__tty_colors); \
+ @$(am__set_TESTS_bases); \
## Helper shell function, tells whether a path refers to an existing,
## regular, readable file.
f_ok () { test -f "$$1" && test -r "$$1"; }; \
- $(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)
## only ensure that all the `.log' files exists; they don't ensure that
@@ -150,22 +168,14 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
## tests in order to re-create them.
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
- rm -f $$redo_logs && rm -f $$redo_results \
- && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
- fi; \
-## Sanity check: each unreadable or non-existent test result file should
-## has been properly remade at this point, as should the corresponding log
-## file.
- st=0; \
- for b in $$redo_bases; do \
- for e in trs log; do \
- f_ok $$b.$$e || { \
- echo "fatal: making $@: failed to create $$b.$$e" >&2; \
- st=1; \
- }; \
- done; \
- done; \
- test $$st -eq 0 || exit 1; \
+## The export variables are needed by the helper hook.
+ (export redo_bases redo_logs redo_results \
+ && $(MAKE) am--redo-logs) || exit 1; \
+ else :; fi;
+## We need a new subshell to work portably with "make -n", since the
+## previous part of the recipe contained a $(MAKE) invocation.
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
## List of test result files.
results=`for b in $$bases; do echo $$b.trs; done`; \
test -n "$$results" || results=/dev/null; \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 7610af2..dbf94c1 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -171,10 +171,6 @@ 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.
-am__stealth_MAKE = $(MAKE)
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check check-html recheck recheck-html
TEST_SUITE_LOG = test-suite.log
@@ -1498,9 +1494,30 @@ cscope cscopelist:
# Recover from deleted `.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run `foo.test', and re-create
-# both `foo.log' and `foo.trs'.
+# both `foo.log' and `foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
.log.trs:
- rm -f $< $@ && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $<
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Helper recipe used by $(TEST_SUITE_LOG) below, to avoid problems with
+# "make -n". Break this recipe in multiple shell invocations too, to
+# really work as expected with "make -n".
+am--redo-logs:
+ @rm -f $$redo_logs
+ @rm -f $$redo_results
+ @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+ @st=0; \
+ for b in $$redo_bases; do \
+ for e in trs log; do \
+ if test ! -f $$b.$$e || test ! -r $$b.$$e; then \
+ echo "fatal: making $(TEST_SUITE_LOG): failed to create" \
+ "$$b.$$e" >&2; \
+ st=1; \
+ fi; \
+ done; \
+ done; \
+ test $$st -eq 0
$(TEST_SUITE_LOG): $(TEST_LOGS)
@$(am__sh_e_setup); $(am__tty_colors); \
@@ -1513,19 +1530,9 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
if test -n "$$redo_bases"; then \
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
- rm -f $$redo_logs && rm -f $$redo_results \
- && $(am__stealth_MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ (export redo_bases redo_logs redo_results \
+ && $(MAKE) am--redo-logs) || exit 1; \
fi; \
- st=0; \
- for b in $$redo_bases; do \
- for e in trs log; do \
- f_ok $$b.$$e || { \
- echo "fatal: making $@: failed to create $$b.$$e" >&2; \
- st=1; \
- }; \
- done; \
- done; \
- test $$st -eq 0 || exit 1; \
results=`for b in $$bases; do echo $$b.trs; done`; \
test -n "$$results" || results=/dev/null; \
all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
@@ -1810,16 +1817,17 @@ uninstall-am:
.MAKE: check-am check-html install-am install-strip recheck \
recheck-html
-.PHONY: all all-am check check-TESTS check-am check-html clean \
- clean-generic clean-local distclean distclean-generic distdir \
- dvi dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am recheck recheck-html uninstall uninstall-am
+.PHONY: all all-am am--redo-logs check check-TESTS check-am check-html \
+ clean clean-generic clean-local distclean distclean-generic \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am recheck recheck-html \
+ uninstall uninstall-am
backcompat5-p.log: backcompat5.test
check-exported-srcdir-p.log: check-exported-srcdir.test
--
1.7.2.3
- [FYI] {test-protocols} test harness: "make -n check" works correctly with Solaris make,
Stefano Lattarini <=