[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TES
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TEST_EXTENSIONS) |
Date: |
Tue, 22 May 2012 22:50:56 +0200 |
Since the beginning of the parallel-tests harness, we've been requiring
that the entries in $(TEST_EXTENSIONS) begin with a dot (as suggested by
the name "extensions"). But it's clear that if an user writes something
like:
TEST_EXTENSIONS = test sh
he actually means:
TEST_EXTENSIONS = .test .sh
So let's try to be more user-friendly, and some DWIM processing on the
content of $(TEST_EXTENSIONS).
* automake.in (is_valid_test_extension): Drop this, it's a no-op now.
(handle_tests): Don't call that anymore. Simplify accordingly.
Drop the '%INVALID_TEST_EXTENSIONS%' transform when processing ...
* lib/am/parallel-tests.am: ... this file. Drop warnings about invalid
test extensions. Enhance so that it can deal with dot-less entries in
$(TEST_EXTENSIONS), with the semantics explained above, with the help
of ...
(am__dotted_test_extensions, am__dotless_test_extensions): ... these new
internal variables (memoized).
(am__tpfx): Simplified accordingly.
(am__get_test_bases): Adjust to use '$(am__dotted_test_extensions)'
instead of bare '$(TEST_EXTENSIONS)'.
* t/test-extensions-funny-chars.sh: Adjust a little, to enhance coverage.
* t/parallel-tests-internals.sh: Adjust and extend.
* t/test-extensions.sh: Remove as obsolete.
* Makefile.am (XFAIL_TESTS): Drop the removed test.
Signed-off-by: Stefano Lattarini <address@hidden>
---
Makefile.am | 1 -
automake.in | 21 +----------
lib/am/parallel-tests.am | 26 +++++++-------
t/parallel-tests-internals.sh | 11 +++---
t/test-extensions-dotless.sh | 55 +++++++++++++++++++++++++++++
t/test-extensions-funny-chars.sh | 2 +-
t/test-extensions.sh | 71 --------------------------------------
7 files changed, 78 insertions(+), 109 deletions(-)
create mode 100755 t/test-extensions-dotless.sh
delete mode 100755 t/test-extensions.sh
diff --git a/Makefile.am b/Makefile.am
index ea0d65c..60d5ab7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -388,7 +388,6 @@ 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 87285e1..8f59332 100644
--- a/automake.in
+++ b/automake.in
@@ -4551,20 +4551,6 @@ sub handle_tests_dejagnu
$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-# is_valid_test_extension ($EXT)
-# ------------------------------
-# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
-# otherwise.
-sub is_valid_test_extension ($)
-{
- my $ext = shift;
- return 1
- if ($ext =~ /^\./);
- return 1
- if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
- return 0;
-}
-
# Handle TESTS variable and other checks.
sub handle_tests
{
@@ -4607,15 +4593,10 @@ sub handle_tests
msg_var 'unsupported', $var,
"'TEST_EXTENSIONS' cannot have conditional contents";
}
- my @test_suffixes = $var->value_as_list_recursive;
- my @invalid_test_suffixes = grep { !is_valid_test_extension $_ }
- @test_suffixes;
- @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
$output_rules .=
file_contents ('parallel-tests', new Automake::Location,
COLOR => !! option 'color-tests',
- CHECK_DEPS => "@check",
- INVALID_TEST_EXTENSIONS =>
"@invalid_test_suffixes");
+ CHECK_DEPS => "@check");
$clean_files{'$(am__test_logs)'} = MOSTLY_CLEAN;
$clean_files{'$(am__test_results)'} = MOSTLY_CLEAN;
$clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am
index 1fb5359..4d3aec0 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -25,12 +25,6 @@ include color-tests.am
## of more test metadata, and the use of custom test derivers and protocols
## (among them, TAP).
-am__invalid_test_extensions = %INVALID_TEST_EXTENSIONS%
-$(if $(am__invalid_test_extensions), \
- $(foreach am__e, $(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)
@@ -66,16 +60,15 @@ am__runtest = \
$(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)))
+am__tpfx = $(if $(strip $1),$(call am__toupper,$(strip $(1))_))
!define am__handle_per_suffix_test
!$$(call am__tpfx,$1)LOG_DRIVER ?= $(SHELL) $(am__config_aux_dir)/test-driver
-!%.log %.trs: %$1 $$($$(call am__tpfx,$1)LOG_DEPENDENCIES)
+!%.log %.trs: %$(if $1,.$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)
+!%.log %.trs: %$(if $1,.$1)$(EXEEXT) $$($$(call am__tpfx,$1)LOG_DEPENDENCIES)
! @$$(call am__runtest,$$(call am__tpfx,$1))
!endif # defined EXEEXT
!endif # am__handle_exeext = yes
@@ -83,7 +76,7 @@ am__tpfx = \
!
## FIXME: it would be nice to break these on multiple lines. Unfortnately,
## FIXME: our '!' is not yet smart enough to handle that :-(
-!$(foreach am__e,$(TEST_EXTENSIONS), $(eval $(call
am__handle_per_suffix_test,$(am__e))))
+!$(foreach am__e,$(am__dotless_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
@@ -92,6 +85,15 @@ am__tpfx = \
## all sort of mishaps and confusion.
!$(eval $(call am__handle_per_suffix_test))
+## The entries of $(TEST_EXTENSIONS), with leading dot (if any) stripped.
+am__dotless_test_extensions = \
+ $(call am__memoize,am__dotless_test_extensions,$(strip \
+ $(patsubst .%,%,$(TEST_EXTENSIONS))))
+## The entries of $(TEST_EXTENSIONS), with leading dot (if missing) added.
+am__dotted_test_extensions = \
+ $(call am__memoize,am__dotted_test_extensions,$(strip \
+ $(patsubst %,.%,$(am__dotless_test_extensions))))
+
# The names of the given tests scripts with any possible registered
# test extension removed, as well as any leading '$(srcdir)' component
# (if any) stripped.
@@ -102,7 +104,7 @@ am__tpfx = \
# 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), \
+$(call am__strip_suffixes, $(am__dotted_test_extensions), \
?!HANDLE-EXEEXT? $(1))))
?HANDLE-EXEEXT? $(patsubst %$(EXEEXT),%,$(1)))))
diff --git a/t/parallel-tests-internals.sh b/t/parallel-tests-internals.sh
index 8614c5c..1dc1cdf 100755
--- a/t/parallel-tests-internals.sh
+++ b/t/parallel-tests-internals.sh
@@ -24,14 +24,17 @@ END
cat > Makefile.am << 'END'
TESTS =
+TEST_EXTENSIONS = sh .test 0 .1
.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,test)' = x'TEST_'
+ test x'$(call am__tpfx,sh.5)' = x'SH.5_'
+ test x'$(call am__tpfx,x_y)' = x'X_Y_'
test x'$(call am__tpfx, )' = x
- test x'$(call am__tpfx, .t )' = x'T_'
+ test x'$(call am__tpfx, t )' = x'T_'
+ test '$(am__dotless_test_extensions)' = 'sh test 0 1'
+ test '$(am__dotted_test_extensions)' = '.sh .test .0 .1'
END
$ACLOCAL
diff --git a/t/test-extensions-dotless.sh b/t/test-extensions-dotless.sh
new file mode 100755
index 0000000..c103486
--- /dev/null
+++ b/t/test-extensions-dotless.sh
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 2011-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/>.
+
+# Dot-less entries in $(TEST_EXTENSIONS).
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat >> Makefile.am <<'END'
+TEST_EXTENSIONS = sh .test t
+TESTS = foo.sh bar.test baz.t tut a-sh
+END
+
+cat > a-sh << 'END'
+#!/bin/sh
+exit 0
+END
+chmod a+x a-sh
+
+cp a-sh foo.sh
+cp a-sh bar.test
+cp a-sh baz.t
+cp a-sh tut
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=5 pass=5 fail=0 skip=0 xfail=0 xpass=0 error=0
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f tut.log
+test -f a-sh.log
+
+
+:
diff --git a/t/test-extensions-funny-chars.sh b/t/test-extensions-funny-chars.sh
index d189bfe..a445538 100755
--- a/t/test-extensions-funny-chars.sh
+++ b/t/test-extensions-funny-chars.sh
@@ -24,7 +24,7 @@ fetch_tap_driver
echo AC_OUTPUT >> configure.ac
cat >> Makefile.am <<'END'
-TEST_EXTENSIONS = .@ .f-o-o .l!Nu.x
+TEST_EXTENSIONS = .@ f-o-o .l!Nu.x
TESTS = foo.@ bar.f-o-o zardoz.l!Nu.x
XFAIL_TESTS = zardoz.l!Nu.x
@_LOG_COMPILER = $(SHELL)
diff --git a/t/test-extensions.sh b/t/test-extensions.sh
deleted file mode 100755
index b2e037f..0000000
--- a/t/test-extensions.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-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/>.
-
-# Make sure that Automake diagnose invalid entries in TEST_EXTENSIONS,
-# and do not diagnose valid (albeit more unusual) ones.
-# See automake bug#9400.
-
-. ./defs || Exit 1
-
-cat >> configure.ac <<'END'
-AC_OUTPUT
-END
-
-$ACLOCAL
-$AUTOCONF
-
-valid_extensions='sh T t1 _foo BAR x_Y_z _'
-
-echo TESTS = > Makefile.am
-echo " $valid_extensions" \
- | sed -e 's/ / ./g' -e 's/^/TEST_EXTENSIONS =/' >> Makefile.am
-cat Makefile.am # For debugging.
-
-$AUTOMAKE -a
-
-grep -i 'log' Makefile.in # For debugging.
-
-for lc in $valid_extensions; do
- uc=`echo $lc | tr '[a-z]' '[A-Z]'`
- grep "^${uc}_LOG_DRIVER =" Makefile.in
- grep "^%\.log %\.trs *:.*%\.${lc}" Makefile.in
-done
-
-# The produced Makefile is not broken.
-./configure
-$MAKE all check
-$MAKE distclean
-
-cat > Makefile.am << 'END'
-TESTS = foo.test bar.sh
-TEST_EXTENSIONS = .test mu .x-y a-b .t.1 .sh .6c .0 .11
-TEST_EXTENSIONS += .= .t33 address@hidden _&_
-END
-
-$AUTOMAKE
-./configure
-
-$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-for suf in mu .x-y a-b .t.1 .6c .0 .11 '.=' '_&_'; do
- $FGREP "invalid test extension: '$suf'" stderr
-done
-
-# Verify that we accept valid suffixes, even if intermixed with
-# invalid ones.
-$EGREP 'invalid.*\.(sh|test|t33)' stderr && Exit 1
-
-:
--
1.7.9.5
- Re: [Automake-NG] [PATCH 12/17] [ng] warns: don't report possible issues with '_DEPENDENCIES' variables, (continued)
[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
[Automake-NG] [PATCH 17/17] [ng] cosmetics: improve comments and spacing in 'parallel-tests.am', Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TEST_EXTENSIONS),
Stefano Lattarini <=
- Re: [Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TEST_EXTENSIONS), Akim Demaille, 2012/05/22
- Re: [Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TEST_EXTENSIONS), Stefano Lattarini, 2012/05/22
- [Automake-NG] [PATCH 15/17] [ng] check: warn about dot-less $(TEST_EXTENSIONS) at make runtime, Stefano Lattarini, 2012/05/22
- Re: [Automake-NG] [PATCH 15/17] [ng] check: warn about dot-less $(TEST_EXTENSIONS) at make runtime, Akim Demaille, 2012/05/23
- [Automake-NG] A new TODO file for Automake-NG? (was: Re: [PATCH 15/17] [ng] check: warn about dot-less $(TEST_EXTENSIONS) at make runtime), Stefano Lattarini, 2012/05/23
Re: [Automake-NG] [PATCH 15/17] [ng] check: accept dot-less entries in $(TEST_EXTENSIONS), Akim Demaille, 2012/05/23
[Automake-NG] [PATCH 18/17] [ng] coverage: parallel-tests and dynamic $(TEST_EXTENSIONS) content, Stefano Lattarini, 2012/05/22
[Automake-NG] [PATCH 19/17] [ng] doc: update w.r.t. recent changes in testsuite harnesses (TESTS-based), Stefano Lattarini, 2012/05/23
[Automake-NG] [PATCH 20/17] [ng] news: update w.r.t. recent changes in testsuite harnesses (TESTS based), Stefano Lattarini, 2012/05/23