[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-ng] [PATCH 2/4] [ng] parallel-tests: reduce code duplication a
From: |
Stefano Lattarini |
Subject: |
[Automake-ng] [PATCH 2/4] [ng] parallel-tests: reduce code duplication a little |
Date: |
Sun, 15 Apr 2012 21:55:13 +0200 |
Use more GNU make features and built-ins, and less automake-time
pre-processing, in order to reduce code duplication and improve
clarity.
* lib/am/check2.am: Define a new custom make function 'am__runtest', used
to simplify rules in here, and reduce code duplication among them.
* automake.in (handle_per_suffix_test): Update and simplify accordingly.
As a result, the automake-defined 'LOG_COMPILE' variables are not defined
anymore, which we should mention ...
* NG-NEWS: ... in here.
* t/test-extensions.sh: Adjust outdated grepping checks.
Signed-off-by: Stefano Lattarini <address@hidden>
---
NG-NEWS | 7 +++++++
automake.in | 13 +------------
lib/am/check2.am | 28 ++++++++++++++++++++--------
t/test-extensions.sh | 3 +--
4 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/NG-NEWS b/NG-NEWS
index ab7ee2e..6da558e 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -59,6 +59,13 @@ Warnings and diagnostic
* The 'portability-recursive' warning category is obsolete, and has been
removed.
+Parallel testsuite harness
+==========================
+
+* Automake does not automatically generate the definition of 'LOG_COMPILE'
+ variables anymore. These have always been meant for internal use only
+ anyway.
+
Miscellaneous
=============
diff --git a/automake.in b/automake.in
index 820285b..bb47528 100644
--- a/automake.in
+++ b/automake.in
@@ -4743,20 +4743,9 @@ sub handle_per_suffix_test
"\$(SHELL) $am_config_aux_dir/test-driver",
INTERNAL);
}
- my $driver = '$(' . $pfx . 'LOG_DRIVER)';
- my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
- . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
- my $compile = "${pfx}LOG_COMPILE";
- define_variable ($compile,
- '$(' . $pfx . 'LOG_COMPILER)'
- . ' $(AM_' . $pfx . 'LOG_FLAGS)'
- . ' $(' . $pfx . 'LOG_FLAGS)',
- INTERNAL);
$output_rules .= file_contents ('check2', new Automake::Location,
GENERIC => $generic,
- DRIVER => $driver,
- DRIVER_FLAGS => $driver_flags,
- COMPILE => '$(' . $compile . ')',
+ PFX => $pfx,
EXT => $test_suffix,
am__EXEEXT => $am_exeext,
%transform);
diff --git a/lib/am/check2.am b/lib/am/check2.am
index a14e775..112a7b6 100644
--- a/lib/am/check2.am
+++ b/lib/am/check2.am
@@ -14,13 +14,28 @@
## 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__runtest = \
+ p=$<; $(am__check_pre) \
+ $($(1)LOG_DRIVER) \
+ --test-name "$$f" \
+ --log-file $(2).log \
+ --trs-file $(2).trs \
+ $(am__common_driver_flags) \
+ $(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.
?GENERIC?%EXT%.log:
?!GENERIC?%OBJ%: %SOURCE%
- @p='%SOURCE%'; $(am__check_pre) %DRIVER% --test-name "$$f" \
- --log-file '%BASE%.log' --trs-file '%BASE%.trs' \
- $(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
+ @$(call am__runtest,%PFX%,%BASE%)
## If no programs are built in this package, then this rule is removed
## at automake time. Otherwise, %am__EXEEXT% expands to a configure time
@@ -28,8 +43,5 @@
## conflict with the previous one.
if %am__EXEEXT%
?GENERIC?%EXT%$(EXEEXT).log:
- @p='%SOURCE%'; $(am__check_pre) %DRIVER% --test-name "$$f" \
- --log-file '%BASE%.log' --trs-file '%BASE%.trs' \
- $(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
+ @$(call am__runtest,%PFX%,%BASE%)
endif %am__EXEEXT%
diff --git a/t/test-extensions.sh b/t/test-extensions.sh
index d2fc2dd..c903798 100755
--- a/t/test-extensions.sh
+++ b/t/test-extensions.sh
@@ -41,8 +41,7 @@ grep -i 'log' Makefile.in # For debugging.
for lc in $valid_extensions; do
uc=`echo $lc | tr '[a-z]' '[A-Z]'`
- $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in
- grep "^${uc}_LOG_COMPILE =" Makefile.in
+ grep "^${uc}_LOG_DRIVER =" Makefile.in
grep "^\.${lc}\.log:" Makefile.in
done
--
1.7.9.5