* tests/am/check.am (am__set_TESTS_bases, $(TEST_SUITE_LOGS), am--redo-logs, recheck, recheck-html): Cosmetic fixlets to minimize the risk of unwanted VPATH rewrites. (check-TESTS): Likewise, and normalize trailing whitespace since we are at it.
Bugs exposed by test cases `check6-p.test' and `check7-p.test'. --- ChangeLog | 10 ++++++ lib/Automake/tests/Makefile.in | 62 +++++++++++++++++++------------------- lib/am/check.am | 64 ++++++++++++++++++++-------------------- tests/Makefile.in | 62 +++++++++++++++++++------------------- 4 files changed, 104 insertions(+), 94 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d34453..232230d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2011-08-08 Stefano Lattarini <stefano.lattar...@gmail.com> + test harness: more minor VPATH-rewrite issues + * tests/am/check.am (am__set_TESTS_bases, $(TEST_SUITE_LOGS), + am--redo-logs, recheck, recheck-html): Cosmetic fixlets to + minimize the risk of unwanted VPATH rewrites. + (check-TESTS): Likewise, and normalize trailing whitespace + since we are at it. + Bugs exposed by test cases `check6-p.test' and `check7-p.test'. + +2011-08-08 Stefano Lattarini <stefano.lattar...@gmail.com> + 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), diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 5594390..fff8f6e 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -164,7 +164,7 @@ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # See also 'test-harness-vpath-rewrite.test' and 'test-trs-basic.test'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ - bases=`for f in $$bases; do echo $$f; done | sed 's/\.log$$//'`; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check check-html recheck recheck-html @@ -353,29 +353,29 @@ 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; \ + @st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs"; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log"; st=1; }; \ done; \ test $$st -eq 0 $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ - f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for b in $$bases; do \ - f_ok $$b.trs && f_ok $$b.log || echo $$b; \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ 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`; \ - (export redo_bases redo_logs redo_results \ - && $(MAKE) am--redo-logs) || exit 1; \ + redo_bases="$$redo_bases" \ + redo_logs="$$redo_logs" \ + redo_results="$$redo_results" \ + $(MAKE) am--redo-logs || exit 1; \ else :; fi; @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ @@ -429,20 +429,20 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) echo; \ echo ".. contents:: :depth: 2"; \ echo; \ - for b in $$bases; do \ - if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$b.trs \ + for i in $$bases; do \ + if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \ >/dev/null; then continue; \ fi; \ glob_res=`sed -n -e "s/$$ws*$$//" \ -e "s/^$$ws*:global-test-result:$$ws*//p" \ - $$b.trs`; \ + $$i.trs`; \ test -n "$$glob_res" || glob_res=RUN; \ - echo "$$glob_res: $$b" | $(am__rst_section); \ - if test ! -r $$b.log; then \ - echo "fatal: making $@: $$b.log is unreadable" >&2; \ + echo "$$glob_res: $$i" | $(am__rst_section); \ + if test ! -r $$i.log; then \ + echo "fatal: making $@: $$i.log is unreadable" >&2; \ exit 1; \ fi; \ - cat $$b.log; echo; \ + cat $$i.log; echo; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ @@ -471,11 +471,11 @@ check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @list='$(TEST_LOGS)'; \ - list=`for f in $$list; do \ - test .log = $$f || echo $$f; \ - done | tr '\012\015' ' '`; \ - list=`echo "$$list" | sed 's/ *$$//'`; \ + @list='$(TEST_LOGS)'; \ + list=`for i in $$list; do \ + test .log = $$i || echo $$i; \ + done | tr '\012\015' ' '`; \ + list=`echo "$$list" | sed 's/ *$$//'`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" .log.html: @@ -506,10 +506,10 @@ recheck recheck-html: @ws='[ ]'; \ target=`echo $@ | sed 's,^re,,'`; \ $(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 2>&1 || echo $$b.log; \ + list=`for i in $$bases; do \ + test -f $$i.trs || test -f $$i.log || continue; \ + grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \ + >/dev/null 2>&1 || echo $$i.log; \ done | tr '\012\015' ' '`; \ list=`echo "$$list" | sed 's/ *$$//'`; \ $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' diff --git a/lib/am/check.am b/lib/am/check.am index d1daac6..2b58c57 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -113,7 +113,7 @@ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # See also 'test-harness-vpath-rewrite.test' and 'test-trs-basic.test'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ - bases=`for f in $$bases; do echo $$f; done | sed 's/\.log$$//'`; \ + bases=`for i in $$bases; do echo $$i; 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` @@ -136,15 +136,13 @@ am--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; \ + @st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs"; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log"; st=1; }; \ done; \ test $$st -eq 0 .PHONY: am--redo-logs @@ -153,14 +151,14 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) @$(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__f_ok () { test -f "$$1" && test -r "$$1"; }; \ ## 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 ## the `.log' files are readable, and worse, they don't ensure that the ## `.trs' files even exist. - redo_bases=`for b in $$bases; do \ - f_ok $$b.trs && f_ok $$b.log || echo $$b; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ ## Uh-oh, either some `.log' files were unreadable, or some `.trs' files @@ -168,9 +166,11 @@ $(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`; \ -## The export variables are needed by the helper hook. - (export redo_bases redo_logs redo_results \ - && $(MAKE) am--redo-logs) || exit 1; \ +## The exported variables are needed by the helper hook. + redo_bases="$$redo_bases" \ + redo_logs="$$redo_logs" \ + redo_results="$$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. @@ -240,27 +240,27 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) echo; \ echo ".. contents:: :depth: 2"; \ echo; \ - for b in $$bases; do \ + for i in $$bases; do \ ## FIXME: one fork per test -- this is horrendously inefficient! - if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$b.trs \ + if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \ >/dev/null; then continue; \ fi; \ ## Get the declared "global result" of the test. ## FIXME: yet another one fork per test here! glob_res=`sed -n -e "s/$$ws*$$//" \ -e "s/^$$ws*:global-test-result:$$ws*//p" \ - $$b.trs`; \ + $$i.trs`; \ ## If no global result is explicitly declared, we'll merely mark the ## test as "RUN" in the global test log. test -n "$$glob_res" || glob_res=RUN; \ ## Write the name and result of the test as an RST section title. - echo "$$glob_res: $$b" | $(am__rst_section); \ + echo "$$glob_res: $$i" | $(am__rst_section); \ ## If we should have remade any unreadable `.log', above. - if test ! -r $$b.log; then \ - echo "fatal: making $@: $$b.log is unreadable" >&2; \ + if test ! -r $$i.log; then \ + echo "fatal: making $@: $$i.log is unreadable" >&2; \ exit 1; \ fi; \ - cat $$b.log; echo; \ + cat $$i.log; echo; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ @@ -309,13 +309,13 @@ check-TESTS: ## 3.80 to erroneously expand $(TESTS_LOGS) to `foo.log .log'. ## Work around this bug. @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @list='$(TEST_LOGS)'; \ - list=`for f in $$list; do \ - test .log = $$f || echo $$f; \ - done | tr '\012\015' ' '`; \ + @list='$(TEST_LOGS)'; \ + list=`for i in $$list; do \ + test .log = $$i || echo $$i; \ + done | tr '\012\015' ' '`; \ ## This apparently useless munging helps to avoid a nasty bug (a ## segmentation fault!) on Solaris XPG4 make. - list=`echo "$$list" | sed 's/ *$$//'`; \ + list=`echo "$$list" | sed 's/ *$$//'`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" AM_RECURSIVE_TARGETS += check @@ -363,13 +363,13 @@ recheck recheck-html: @ws='[ ]'; \ target=`echo $@ | sed 's,^re,,'`; \ $(am__set_TESTS_bases); \ - list=`for b in $$bases; do \ + list=`for i in $$bases; do \ ## Skip tests that haven't been run, but recover gracefully from deleted ## `.trs' files. - test -f $$b.trs || test -f $$b.log || continue; \ + test -f $$i.trs || test -f $$i.log || continue; \ ## FIXME: one fork per test -- this is horrendously inefficient! - grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$b.trs \ - >/dev/null 2>&1 || echo $$b.log; \ + grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \ + >/dev/null 2>&1 || echo $$i.log; \ done | tr '\012\015' ' '`; \ ## This apparently useless munging helps to avoid a nasty bug (a ## segmentation fault!) on Solaris XPG4 make. diff --git a/tests/Makefile.in b/tests/Makefile.in index c35e270..3573bb0 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -169,7 +169,7 @@ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # See also 'test-harness-vpath-rewrite.test' and 'test-trs-basic.test'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ - bases=`for f in $$bases; do echo $$f; done | sed 's/\.log$$//'`; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check check-html recheck recheck-html @@ -1507,29 +1507,29 @@ 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; \ + @st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs"; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log"; st=1; }; \ done; \ test $$st -eq 0 $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ - f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for b in $$bases; do \ - f_ok $$b.trs && f_ok $$b.log || echo $$b; \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ 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`; \ - (export redo_bases redo_logs redo_results \ - && $(MAKE) am--redo-logs) || exit 1; \ + redo_bases="$$redo_bases" \ + redo_logs="$$redo_logs" \ + redo_results="$$redo_results" \ + $(MAKE) am--redo-logs || exit 1; \ else :; fi; @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ @@ -1583,20 +1583,20 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) echo; \ echo ".. contents:: :depth: 2"; \ echo; \ - for b in $$bases; do \ - if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$b.trs \ + for i in $$bases; do \ + if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \ >/dev/null; then continue; \ fi; \ glob_res=`sed -n -e "s/$$ws*$$//" \ -e "s/^$$ws*:global-test-result:$$ws*//p" \ - $$b.trs`; \ + $$i.trs`; \ test -n "$$glob_res" || glob_res=RUN; \ - echo "$$glob_res: $$b" | $(am__rst_section); \ - if test ! -r $$b.log; then \ - echo "fatal: making $@: $$b.log is unreadable" >&2; \ + echo "$$glob_res: $$i" | $(am__rst_section); \ + if test ! -r $$i.log; then \ + echo "fatal: making $@: $$i.log is unreadable" >&2; \ exit 1; \ fi; \ - cat $$b.log; echo; \ + cat $$i.log; echo; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ @@ -1625,11 +1625,11 @@ check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @list='$(TEST_LOGS)'; \ - list=`for f in $$list; do \ - test .log = $$f || echo $$f; \ - done | tr '\012\015' ' '`; \ - list=`echo "$$list" | sed 's/ *$$//'`; \ + @list='$(TEST_LOGS)'; \ + list=`for i in $$list; do \ + test .log = $$i || echo $$i; \ + done | tr '\012\015' ' '`; \ + list=`echo "$$list" | sed 's/ *$$//'`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" .log.html: @@ -1660,10 +1660,10 @@ recheck recheck-html: @ws='[ ]'; \ target=`echo $@ | sed 's,^re,,'`; \ $(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 2>&1 || echo $$b.log; \ + list=`for i in $$bases; do \ + test -f $$i.trs || test -f $$i.log || continue; \ + grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \ + >/dev/null 2>&1 || echo $$i.log; \ done | tr '\012\015' ' '`; \ list=`echo "$$list" | sed 's/ *$$//'`; \ $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' -- 1.7.2.3