automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 15/17] [ng] check: warn about dot-less $(TEST_EXTEN


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 15/17] [ng] check: warn about dot-less $(TEST_EXTENSIONS) at make runtime
Date: Wed, 23 May 2012 00:34:33 +0200

* lib/am/parallel-tests.am: Analyze the $(TEST_EXTENSIONS) contents at
make runtime, instead of relying on the '%INVALID_TEST_EXTENSIONS%'
transform once passed in by automake.  Do any necessary error reporting
with the help of ...
(am__maybe_invalid_test_extensions): ... this new function.
* automake.in (is_valid_test_extension): Delete.
(handle_tests): Don't call that anymore.  Simplify accordingly.  Rely
on code in parallel-tests.am to report the proper errors at runtime.
* t/test-extensions.sh: Moved ...
* t/test-extensions-invalid.sh:  ... to this, nd updated.
* Makefile.am (XFAIL_TESTS): Drop 'test-extensions.sh'.

Signed-off-by: Stefano Lattarini <address@hidden>
---

 Here is the patch to be substituted to the old one "[ng] check: accept
 dot-less entries in $(TEST_EXTENSIONS)".

 OK?

 Makefile.am                  |    1 -
 automake.in                  |   21 +------------
 lib/am/parallel-tests.am     |   12 ++++---
 t/test-extensions-invalid.sh |   45 ++++++++++++++++++++++++++
 t/test-extensions.sh         |   71 ------------------------------------------
 5 files changed, 53 insertions(+), 97 deletions(-)
 create mode 100755 t/test-extensions-invalid.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..9131229 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -25,11 +25,12 @@ 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__maybe_invalid_test_extensions = \
+  $(if \
+    $(strip $1), \
+    $(foreach am__e, $1,\
+      $(warning invalid test extension: '$(am__e)')) \
+    $(error invalid test extensions have been encountered))
 
 am__is_xfail_test = \
   $(if $(filter-out $(am__xfail_test_bases), \
@@ -81,6 +82,7 @@ am__tpfx = \
 !endif # am__handle_exeext = yes
 !endef
 !
+!$(call am__maybe_invalid_test_extensions,$(filter-out .%,$(TEST_EXTENSIONS)))
 ## 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))))
diff --git a/t/test-extensions-invalid.sh b/t/test-extensions-invalid.sh
new file mode 100755
index 0000000..c806a0e
--- /dev/null
+++ b/t/test-extensions-invalid.sh
@@ -0,0 +1,45 @@
+#! /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 invalid entries in TEST_EXTENSIONS are diagnosed at
+# make runtime.  See automake bug#9400.
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+TESTS =
+TEST_EXTENSIONS = mu x1 .foo _ x2
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+for suf in mu x1 _ x2; do
+  $FGREP "invalid test extension: '$suf'" stderr
+done
+
+# Verify that we don't report valid suffixes, even if intermixed
+# with invalid ones.
+grep 'invalid.*\.foo' stderr && Exit 1
+
+:
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]