automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 04/11] [ng] check: refactor (better names for inter


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 04/11] [ng] check: refactor (better names for internal vars)
Date: Wed, 9 May 2012 11:30:09 +0200

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 <address@hidden>
---
 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 eecbb92..c553e4e 100644
--- a/automake.in
+++ b/automake.in
@@ -4792,8 +4792,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 2eee953..46015cd 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 </dev/null`; \
 ## Catch I/O errors, and complain accordingly.
          test $$? -le 1 || fatal "I/O error reading test results"; \
@@ -332,7 +332,7 @@ $(TEST_SUITE_LOG): $(am__TEST_LOGS) $(am__TEST_RESULTS)
          echo;                                                         \
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
-         bases='$(am__TEST_BASES)';                                    \
+         bases='$(am__test_bases)';                                    \
          for b in $$bases; do echo $$b; done                           \
            | $(am__create_global_log);                                 \
        } >$(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 86a1fae..c543fea 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -60,6 +60,9 @@ sc_tests_make_can_chain_suffix_rules \
 sc_tests_make_dont_do_useless_vpath_rebuilds \
 sc_no_dotmake_target \
 sc_no_am_makeflags \
+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 \
@@ -296,6 +299,20 @@ sc_no_am_makeflags:
          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 163b72f..f16095b 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 7e406e7..9ac0c5d 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 4b5e198..43e3854 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'
-- 
1.7.9.5




reply via email to

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