From 8c01ea77d45fc0d36479845659701f4e673ddea4 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 7 May 2012 17:02:01 +0200 Subject: [PATCH] [ng] check: refactor (better names for internal vars) Rename some Automake-defined internal make variables as follows: am__TEST_BASES => am__test_bases am__TEST_RESULTS => am__test_results am__TEST_LOGS => am__test_logs * automake.in, lib/am/check.am, t/parallel-tests-empty-tests.sh, t/test-trs-basic.sh, t/serial-tests.sh: Update accordingly. * syntax-checks.mk (sc_no_am_TEST_BASES, sc_no_am_TEST_RESULTS, sc_no_am_TEST_LOGS): New maintainer checks, to ensure the old names are not used by mistake. (syntax_check_rules): Add them. Signed-off-by: Stefano Lattarini --- automake.in | 4 ++-- lib/am/check.am | 22 +++++++++++----------- syntax-checks.mk | 17 +++++++++++++++++ t/parallel-tests-empty-tests.sh | 2 +- t/serial-tests.sh | 4 ++-- t/test-trs-basic.sh | 4 ++-- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/automake.in b/automake.in index 3983eb8be..01fb18597 100644 --- a/automake.in +++ b/automake.in @@ -4743,8 +4743,8 @@ sub handle_tests { handle_per_suffix_test ($test_suffix); } - $clean_files{'$(am__TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(am__TEST_RESULTS)'} = MOSTLY_CLEAN; + $clean_files{'$(am__test_logs)'} = MOSTLY_CLEAN; + $clean_files{'$(am__test_results)'} = MOSTLY_CLEAN; $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; } else diff --git a/lib/am/check.am b/lib/am/check.am index 2eee953e9..46015cdeb 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -220,7 +220,7 @@ f='$(patsubst $(srcdir)/%,%,$<)'; \ ## We need to invoke the test in way that won't cause a PATH search. ## Quotes around '$<' are required to avoid extra errors when a circular ## dependency is detected (e.g., because $(TEST_SUITE_LOG) is in -## $(TEST_LOGS)), because in that case '$<' expands to empty and an +## $(am__test_logs)), because in that case '$<' expands to empty and an ## unquote usage of it could cause syntax errors in the shell. case '$<' in */*) tst='$<';; *) tst=./'$<';; esac; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ @@ -236,29 +236,29 @@ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # This supports runtime overriding of $(TESTS) and $(XFAIL_TESTS). -am__TEST_BASES = $(call am__get_test_bases, $(TESTS)) +am__test_bases = $(call am__get_test_bases, $(TESTS)) am__xfail_test_bases = $(call am__get_test_bases, $(XFAIL_TESTS)) # The $(strip) is to work around the GNU make 3.80 bug where trailing # whitespace in "TESTS = foo.test $(empty)" causes $(TESTS_LOGS) to # erroneously expand to "foo.log .log". -am__TEST_RESULTS = $(addsuffix .trs,$(strip $(am__TEST_BASES))) -am__TEST_LOGS = $(addsuffix .log,$(strip $(am__TEST_BASES))) +am__test_results = $(addsuffix .trs,$(strip $(am__test_bases))) +am__test_logs = $(addsuffix .log,$(strip $(am__test_bases))) # $(TEST_LOGS) is a published interface. -TEST_LOGS = $(am__TEST_LOGS) +TEST_LOGS = $(am__test_logs) -$(TEST_SUITE_LOG): $(am__TEST_LOGS) $(am__TEST_RESULTS) +$(TEST_SUITE_LOG): $(am__test_logs) $(am__test_results) @$(am__sh_e_setup); $(am__tty_colors); \ fatal () { echo "fatal: making $@: $$*" >&2; exit 1; }; \ ## Detect a possible circular dependency, and error out. - case ' $(strip $(TEST_LOGS)) ' in *' $(TEST_SUITE_LOG) '*) \ + case ' $(strip $(am__test_logs)) ' in *' $(TEST_SUITE_LOG) '*) \ fatal "depends on itself (check TESTS content)";; \ esac; \ ws='[ ]'; \ count_result () \ { \ - r='$(strip $(am__TEST_RESULTS))'; \ + r='$(strip $(am__test_results))'; \ r=`grep "^$$ws*:test-result:$$ws*$${1-}" $$r $(TEST_SUITE_LOG).tmp; then \ @@ -394,7 +394,7 @@ check-TESTS recheck: ## cannot use '$?' to compute the set of lazily rerun tests, lest ## we rely on .PHONY to work portably. @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @bases='$(am__TEST_BASES)'; \ + @bases='$(am__test_bases)'; \ if test $@ = recheck; then \ ## If running a "make recheck", we must only consider tests that had an ## unexpected outcome (FAIL or XPASS) in the earlier run. @@ -415,7 +415,7 @@ check-TESTS recheck: test -z "$$log_list" || rm -f $$log_list; \ test -z "$$trs_list" || rm -f $$trs_list; \ fi; \ - $(MAKE) $(TEST_SUITE_LOG) am__TEST_BASES="$$bases" + $(MAKE) $(TEST_SUITE_LOG) am__test_bases="$$bases" ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc. ## It must also depend on the 'all' target. See automake bug#11252. diff --git a/syntax-checks.mk b/syntax-checks.mk index 9f108eed9..420d73732 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -64,6 +64,9 @@ sc_no_am_makeflags \ sc_no_DISTFILES \ sc_no_DIST_COMMON \ sc_no_DIST_SOURCES \ +sc_no_am_TEST_BASES \ +sc_no_am_TEST_RESULTS \ +sc_no_am_TEST_LOGS \ sc_tests_no_make_e \ sc_docs_no_make_e \ sc_make_simple_include \ @@ -319,6 +322,20 @@ sc_no_DISTFILES sc_no_DIST_COMMON sc_no_DIST_SOURCES: sc_no_% : exit 1; \ fi +sc_no_am_TEST_BASES sc_no_am_TEST_RESULTS sc_no_am_TEST_LOGS: sc_no_am_% : + @files="\ + $(xtests) \ + $(pms) \ + $(ams) \ + $(srcdir)/automake.in \ + "; \ + tolower () { LC_ALL=C tr '[A-Z]' '[a-z]'; }; \ + if grep -F 'am__$*' $$files; then \ + echo "'\$$(am__$*)' is obsolete and no more used." >&2; \ + echo "You should use 'am__`echo $* | tolower`' instead." >&2; \ + exit 1; \ + fi + ## "make -e" is brittle and unsafe, since it let *all* the environment ## win over the macro definitions in the Makefiles. We needed it when ## we couldn't assume GNU make, but now that the tide has turned, it's diff --git a/t/parallel-tests-empty-tests.sh b/t/parallel-tests-empty-tests.sh index 163b72f04..f16095bc1 100755 --- a/t/parallel-tests-empty-tests.sh +++ b/t/parallel-tests-empty-tests.sh @@ -33,7 +33,7 @@ mkdir sub1 sub2 cat > sub1/Makefile.am << 'END' TESTS = check-local: - echo $(am__TEST_LOGS) $(am__TEST_RESULTS) $(am__TEST_BASES) \ + echo $(am__test_logs) $(am__test_results) $(am__test_bases) \ | grep . && exit 1; exit 0 END diff --git a/t/serial-tests.sh b/t/serial-tests.sh index 7e406e72b..9ac0c5d32 100755 --- a/t/serial-tests.sh +++ b/t/serial-tests.sh @@ -23,7 +23,7 @@ am_create_testdir=empty hasnt_parallel_tests () { - $EGREP 'TEST_SUITE_LOG|TEST_(LOGS|BASES)|\.log.*:' $1 && Exit 1 + $EGREP -i 'test_suite_log|test_(logs|bases)|\.log.*:' $1 && Exit 1 grep 'recheck.*:' $1 && Exit 1 grep '^check-TESTS: \$(TESTS)$' $1 } @@ -32,7 +32,7 @@ has_parallel_tests () { $EGREP '(^| )check-TESTS.*:' $1 $EGREP '(^| )recheck.*:' $1 - $EGREP '^\$\(TEST_SUITE_LOG\):.* \$\(am__TEST_LOGS\)( |$)' $1 + $EGREP '^\$\(TEST_SUITE_LOG\):.* \$\(am__test_logs\)( |$)' $1 grep '^%.log %.trs *:.*%\.test' $1 } diff --git a/t/test-trs-basic.sh b/t/test-trs-basic.sh index 4b5e19899..43e3854fd 100755 --- a/t/test-trs-basic.sh +++ b/t/test-trs-basic.sh @@ -32,10 +32,10 @@ TEST_LOG_COMPILER = $(SHELL) SH_LOG_COMPILER = $(SHELL) ## Used to check some internal details. And yes, the quotes around -## $(am__TESTS_BASES) are deliberate: they check for whitespace +## $(am__tests_bases) are deliberate: they check for whitespace ## normalization. tb: - echo '$(am__TEST_BASES)' > $@ + echo '$(am__test_bases)' > $@ END cat > foo.test << 'END' -- 2.47.2