]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] check: refactoring to reduce code duplication
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 7 May 2012 14:57:24 +0000 (16:57 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 May 2012 08:04:58 +0000 (10:04 +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 <stefano.lattarini@gmail.com>
lib/am/check.am
t/parallel-tests-empty-tests.sh

index ae40c009961921a095e9d0efc460a88923fe9d22..2eee953e9089c5ad4c44e1cf1277330717cc0e8d 100644 (file)
@@ -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
index 018cce0c7b2704e6c9cc2c4d2092ae29999d6234..163b72f04300b814124194d2e32e4ea7c3e6b894 100755 (executable)
@@ -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