[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 11/17] [ng] refactor: merge check2.am into parallel
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 11/17] [ng] refactor: merge check2.am into parallel-tests.am |
Date: |
Tue, 22 May 2012 22:50:52 +0200 |
Another change aimed at moving logic and processing out of automake
and inside the generated Makefiles. This is mostly a preparatory
step.
* lib/am/check2.am: Merged ...
* lib/am/parallel-tests.am: ... in here, with the (several) required
adjustments and extensions.
* Makefile.am (dist_am_DATA): Adjust.
(XFAIL_TESTS): Add 't/test-extensions.sh'.
* automake.in (handle_per_suffix_test): Don't process nor include
'check2.am' anymore.
* t/parallel-tests-internals.sh: New test.
* t/serial-tests.sh: Adjust grepping checks.
Signed-off-by: Stefano Lattarini <address@hidden>
---
Makefile.am | 2 +-
automake.in | 3 --
lib/am/check2.am | 68 -----------------------------------------
lib/am/parallel-tests.am | 58 +++++++++++++++++++++++++++++++++++
t/parallel-tests-internals.sh | 44 ++++++++++++++++++++++++++
t/serial-tests.sh | 2 +-
6 files changed, 104 insertions(+), 73 deletions(-)
delete mode 100644 lib/am/check2.am
create mode 100755 t/parallel-tests-internals.sh
diff --git a/Makefile.am b/Makefile.am
index 001053c..ea0d65c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -225,7 +225,6 @@ EXTRA_DIST += lib/Automake/Config.in
dist_am_DATA = \
lib/am/serial-tests.am \
lib/am/parallel-tests.am \
- lib/am/check2.am \
lib/am/color-tests.am \
lib/am/clean-hdr.am \
lib/am/clean.am \
@@ -389,6 +388,7 @@ XFAIL_TESTS = \
t/pr8365-remake-timing.sh \
t/remake-am-pr10111.sh \
t/remake-m4-pr10111.sh \
+ t/test-extensions.sh \
t/txinfo5.sh \
$(perl_fake_XFAIL_TESTS)
diff --git a/automake.in b/automake.in
index 5138cf5..08815de 100644
--- a/automake.in
+++ b/automake.in
@@ -4592,9 +4592,6 @@ sub handle_per_suffix_test($)
# ``variable 'LOG_DEPENDENCIES' is defined but no program or
# library has 'LOG' as canonical name (possible typo)''
set_seen ("${pfx}LOG_DEPENDENCIES");
- $output_rules .= file_contents ('check2', new Automake::Location,
- PFX => $pfx,
- EXT => $test_suffix);
}
# is_valid_test_extension ($EXT)
diff --git a/lib/am/check2.am b/lib/am/check2.am
deleted file mode 100644
index 486944c..0000000
--- a/lib/am/check2.am
+++ /dev/null
@@ -1,68 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2008-2012 Free Software Foundation, Inc.
-
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2, or (at your option)
-## any later version.
-
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-if %?FIRST%
-
-am__is_xfail_test = \
- $(if $(filter-out $(am__xfail_test_bases), \
- $(patsubst $(srcdir)/%,%,$(1))),no,yes)
-am__runtest = \
- $(am__sh_e_setup); \
- $(am__tty_colors); \
- srcdir=$(srcdir); export srcdir; \
-## Creates the directory for the log if needed.
- test x$(@D) = x. || test -d $(@D) || $(MKDIR_P) $(@D) || exit $$?; \
-## 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
-## $(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; \
-## Executes the developer-defined and user-defined test
-## setups (if any), in that order.
- $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \
- $($(1)LOG_DRIVER) \
- --test-name '$(patsubst $(srcdir)/%,%,$<)' \
- --log-file $*.log \
- --trs-file $*.trs \
- --color-tests "$$am__color_tests" \
- --enable-hard-errors $(if $(DISABLE_HARD_ERRORS),no,yes) \
- --expect-failure $(call am__is_xfail_test,$*)
\
- $(AM_$(1)LOG_DRIVER_FLAGS) \
- $($(1)LOG_DRIVER_FLAGS) \
- -- \
- $($(1)LOG_COMPILER) \
- $(AM_$(1)LOG_FLAGS) \
- $($(1)LOG_FLAGS) \
- "$$tst" \
- $(AM_TESTS_FD_REDIRECT)
-
-endif %?FIRST%
-
-## From a test file to a .log and .trs file.
-%.log %.trs: %%EXT% $(%PFX%LOG_DEPENDENCIES)
- @$(call am__runtest,%PFX%)
-
-## If no programs are built in this package, then this rule is removed
-## at automake time.
-if %HANDLE-EXEEXT%
-## FIXME: spurious indentnation to avoid Automake thinking this is an
-## automake conditional.
- ifdef EXEEXT
-%.log %.trs: %%EXT%$(EXEEXT) $(%PFX%LOG_DEPENDENCIES)
- @$(call am__runtest,%PFX%)
- endif
-endif %HANDLE-EXEEXT%
diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am
index d0fcebb..c7badec 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -31,6 +31,64 @@ $(if $(am__invalid_test_extensions), \
$(warning invalid test extension: '$(am__e)')) \
$(error invalid test extensions have been encountered))
+am__is_xfail_test = \
+ $(if $(filter-out $(am__xfail_test_bases), \
+ $(patsubst $(srcdir)/%,%,$(1))),no,yes)
+am__runtest = \
+ $(am__sh_e_setup); \
+ $(am__tty_colors); \
+ srcdir=$(srcdir); export srcdir; \
+## Creates the directory for the log file if needed. Avoid extra forks.
+ test x$(@D) = x. || test -d $(@D) || $(MKDIR_P) $(@D) || exit $$?; \
+## 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
+## $(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; \
+## Executes the developer-defined and user-defined test
+## setups (if any), in that order.
+ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \
+ $($(1)LOG_DRIVER) \
+ --test-name '$(patsubst $(srcdir)/%,%,$<)' \
+ --log-file $*.log \
+ --trs-file $*.trs \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors $(if $(DISABLE_HARD_ERRORS),no,yes) \
+ --expect-failure $(call am__is_xfail_test,$*)
\
+ $(AM_$(1)LOG_DRIVER_FLAGS) \
+ $($(1)LOG_DRIVER_FLAGS) \
+ -- \
+ $($(1)LOG_COMPILER) \
+ $(AM_$(1)LOG_FLAGS) \
+ $($(1)LOG_FLAGS) \
+ "$$tst" \
+ $(AM_TESTS_FD_REDIRECT)
+
+## Turn e.g., ".test" in "_TEST", and return the empty string unchanged.
+am__tpfx = \
+ $(if $1,$(call am__toupper,$(patsubst .%,%_,$1)))
+
+!define am__handle_per_suffix_test
+!%.log %.trs: %$1 $$($$(call am__tpfx,$1)LOG_DEPENDENCIES)
+! @$$(call am__runtest,$$(call am__tpfx,$1))
+!ifeq ($(am__handle_exeext),yes)
+!ifdef EXEEXT
+!%.log %.trs: %$1$(EXEEXT) $$($$(call am__tpfx,$1)LOG_DEPENDENCIES)
+! @$$(call am__runtest,$$(call am__tpfx,$1))
+!endif # defined EXEEXT
+!endif # am__handle_exeext = yes
+!endef
+!
+!$(foreach am__e,$(TEST_EXTENSIONS), $(eval $(call
am__handle_per_suffix_test,$(am__e))))
+## It is *imperative* that the "empty" suffix goes last. Otherwise, a
+## declaration like "TESTS = all.test" would cause GNU make to mistakenly
+## try to build the 'all.log' and 'all.trs' files from a non-existent
+## 'all' program (because the Makefile contains an explicit 'all' target,
+## albeith .PHONY), rather than from the 'all.test' script, thus causing
+## all sort of mishaps and confusion.
+!$(eval $(call am__handle_per_suffix_test))
+
# The names of the given tests scripts with any possible registered
# test extension removed, as well as any leading '$(srcdir)' component
# (if any) stripped.
diff --git a/t/parallel-tests-internals.sh b/t/parallel-tests-internals.sh
new file mode 100755
index 0000000..8614c5c
--- /dev/null
+++ b/t/parallel-tests-internals.sh
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Some internals of the parallel testsuite harness implementation.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS =
+.PHONY: test
+test:
+ test x'$(call am__tpfx,)' = x
+ test x'$(call am__tpfx,.test)' = x'TEST_'
+ test x'$(call am__tpfx,.sh5)' = x'SH5_'
+ test x'$(call am__tpfx,.x_y)' = x'X_Y_'
+ test x'$(call am__tpfx, )' = x
+ test x'$(call am__tpfx, .t )' = x'T_'
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE test
+
+:
diff --git a/t/serial-tests.sh b/t/serial-tests.sh
index 353d94c..809c519 100755
--- a/t/serial-tests.sh
+++ b/t/serial-tests.sh
@@ -31,7 +31,7 @@ has_parallel_tests ()
$EGREP '(^| )check-TESTS.*:' $1
$EGREP '(^| )recheck.*:' $1
$EGREP '^\$\(TEST_SUITE_LOG\):.* \$\(am__test_logs\)( |$)' $1
- grep '^%.log %.trs *:.*%\.test' $1
+ grep '%\.log %\.trs *:' $1
}
mkdir one two
--
1.7.9.5
- [Automake-NG] [PATCH 05/17] [ng] refactor: make '$am_config_aux_dir' available as a make variable, (continued)
- [Automake-NG] [PATCH 05/17] [ng] refactor: make '$am_config_aux_dir' available as a make variable, Stefano Lattarini, 2012/05/22
- [Automake-NG] [PATCH 06/17] [ng] check: move definition of console colors in its own '.am' fragment, Stefano Lattarini, 2012/05/22
- [Automake-NG] [PATCH 07/17] [ng] check: separate serial an parallel harnesses in distinct '.am' files, Stefano Lattarini, 2012/05/22
- [Automake-NG] [PATCH 08/17] [ng] check: warn about invalid TEST_EXTENSIONS at make runtime, Stefano Lattarini, 2012/05/22
- [Automake-NG] [PATCH 09/17] [ng] check: unconditionally distribute test-driver, Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 10/17] [ng] am: new make variable '$(am__handle_exxext)', Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 13/17] [ng] check: logic to define *LOG_DRIVER vars moved to generated Makefiles, Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 14/17] [ng] check: be laxer in accepted $(TEST_EXTENSIONS), Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 16/17] [ng] check: support conditional $(TEST_EXTENSIONS), Stefano Lattarini, 2012/05/22