automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 03/11] [ng] check: refactoring to reduce code dupli


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 03/11] [ng] check: refactoring to reduce code duplication
Date: Wed, 9 May 2012 11:30:08 +0200

* lib/am/check.am (am__strip_suffixes): New internal function, factoring
the code used to "normalize" a list of test scripts (i.e., removing any
registered test extension and any leading $(srcdir) component).
(am__TEST_BASES, am__xfail_test_bases): Redefine using that function.
(am__cooked_tests, am__cooked_xfail_tests): Remove as obsolete.
* t/parallel-tests-empty-tests.sh: Don't bother checking the contents
of $(am__cooked_tests) anymore.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 lib/am/check.am                 |   32 +++++++++++++++-----------------
 t/parallel-tests-empty-tests.sh |    3 +--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/lib/am/check.am b/lib/am/check.am
index ae40c00..2eee953 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -57,14 +57,19 @@ if %?PARALLEL_TESTS%
 ## of more test metadata, and the use of custom test derivers and protocols
 ## (among them, TAP).
 
-# Required to support explicit use of $(srcdir) in TESTS entries.
-# That might actually be very useful in practice, for example in usages
-# like this:
+# The names of the given tests scripts with any possible registered
+# test extension removed, as well as any leading '$(srcdir)' component
+# (if any) stripped.
+# The stripping of $(srcdir) is required to support explicit use of
+# $(srcdir) in TESTS entries.  That might actually be very useful in
+# practice, for example in usages like this:
 #   TESTS = $(wildcard $(srcdir)/t[0-9][0-9]*.sh)
-# Removing the '$(srcdir)' in there would cause the idiom to break in
-# VPATH builds.
-am__cooked_tests = $(patsubst $(srcdir)/%,%,$(strip $(TESTS)))
-am__cooked_xfail_tests = $(patsubst $(srcdir)/%,%,$(strip $(XFAIL_TESTS)))
+# where removing the $(srcdir) from the $(wildcard) invocation would
+# cause the idiom to break in VPATH builds.
+am__get_test_bases = $(patsubst $(srcdir)/%,%,$(strip \
+$(call am__strip_suffixes, $(TEST_EXTENSIONS), \
+?!HANDLE-EXEEXT?             $(1))))
+?HANDLE-EXEEXT?              $(patsubst %$(EXEEXT),%,$(1)))))
 
 am__recheck_rx = ^[    ]*:recheck:[    ]*
 am__global_test_result_rx = ^[         ]*:global-test-result:[         ]*
@@ -230,16 +235,9 @@ case " $(am__xfail_test_bases) " in                        
\
 esac;                                                  \
 $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
 
-# The names of the tests scripts with any registered extension removed
-# This honors runtime overriding of TESTS, and takes into account
-# $(EXEEXT) appending.
-am__TEST_BASES = $(call am__strip_suffixes, $(TEST_EXTENSIONS), \
-?!HANDLE-EXEEXT?$(am__cooked_tests))
-?HANDLE-EXEEXT?$(patsubst %$(EXEEXT),%,$(am__cooked_tests)))
-# Likewise for the xfailing tests.
-am__xfail_test_bases = $(call am__strip_suffixes, $(TEST_EXTENSIONS), \
-?!HANDLE-EXEEXT?$(am__cooked_xfail_tests))
-?HANDLE-EXEEXT?$(patsubst %$(EXEEXT),%,$(am__cooked_xfail_tests)))
+# This supports runtime overriding of $(TESTS) and $(XFAIL_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
diff --git a/t/parallel-tests-empty-tests.sh b/t/parallel-tests-empty-tests.sh
index 018cce0..163b72f 100755
--- a/t/parallel-tests-empty-tests.sh
+++ b/t/parallel-tests-empty-tests.sh
@@ -33,8 +33,7 @@ mkdir sub1 sub2
 cat > sub1/Makefile.am << 'END'
 TESTS =
 check-local:
-       echo $(am__cooked_tests) $(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
 
-- 
1.7.9.5




reply via email to

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