From: Stefano Lattarini Date: Mon, 7 May 2012 14:57:24 +0000 (+0200) Subject: [ng] check: refactoring to reduce code duplication X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f11ef5c676fc6fad78a5cb54855789c6d0e47238;p=thirdparty%2Fautomake.git [ng] check: refactoring to reduce code duplication * 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 --- diff --git a/lib/am/check.am b/lib/am/check.am index ae40c0099..2eee953e9 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 018cce0c7..163b72f04 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