automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 14/17] [ng] check: be laxer in accepted $(TEST_EXTE


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 14/17] [ng] check: be laxer in accepted $(TEST_EXTENSIONS)
Date: Tue, 22 May 2012 22:50:55 +0200

Relax our checks on the contents of $(TEST_EXTENSIONS) by simply
verifying that every entry there starts with a dot.

The only reasons the restriction on the $(TEST_EXTENSIONS) was in
place was to ensure the relevant LOG_COMPILER, LOG_DRIVER, etc.,
variables derived from an extension had valid names according to
POSIX; but this is overkill for GNU make, since for it variables
names can happily contain "funny" characters as well (e.g., '!',
'@', '-', ...).

Maybe in the future we could start to again complain about truly
problematic characters (like '$', '=' or ','), but let's not
over-engineer for the moment.  After all, mainline Automake had
suffered from a similar limitation in the long-lived version 1.11
(until commit v1.11-476-g90bea64 of 2011-10-01, "parallel-tests:
automake error our on invalid TEST_EXTENSIONS"), and nobody had
ever complained.

* automake.in (is_valid_test_extension): Be much laxer: accept
all the strings beginning with a do, in addition to the @EXEEXT@
substitution.
* t/test-extensions-funny-chars.sh: New test.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in                      |    2 +-
 t/test-extensions-funny-chars.sh |  123 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100755 t/test-extensions-funny-chars.sh

diff --git a/automake.in b/automake.in
index ed1c12b..87285e1 100644
--- a/automake.in
+++ b/automake.in
@@ -4559,7 +4559,7 @@ sub is_valid_test_extension ($)
 {
   my $ext = shift;
   return 1
-    if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/);
+    if ($ext =~ /^\./);
   return 1
     if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
   return 0;
diff --git a/t/test-extensions-funny-chars.sh b/t/test-extensions-funny-chars.sh
new file mode 100755
index 0000000..d189bfe
--- /dev/null
+++ b/t/test-extensions-funny-chars.sh
@@ -0,0 +1,123 @@
+#! /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 can handle "funny chars" in TEST_EXTENSIONS,
+# as long as they can be used in GNU make variable names.
+
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+echo AC_OUTPUT >> configure.ac
+
+cat >> Makefile.am <<'END'
+TEST_EXTENSIONS = .@ .f-o-o .l!Nu.x
+TESTS = foo.@ bar.f-o-o zardoz.l!Nu.x
+XFAIL_TESTS = zardoz.l!Nu.x
address@hidden = $(SHELL)
+F-O-O_LOG_DRIVER = $(srcdir)/tap-driver
+L!NU.X_LOG_COMPILER = false
+EXTRA_DIST = $(TESTS) tap-driver
+END
+
+touch foo.@ bar.f-o-o zardoz.l!Nu.x \
+  || skip_ "your file system doesn't support funny characters"
+
+# Try to ensure this file fails if executed directly.
+cat > foo.@ << 'END'
+#! /bin/false
+echo @K @K @K
+exit 0
+END
+chmod a-x foo.@ # We don't want it to be executable, either.
+
+cat > bar.f-o-o << 'END'
+#! /bin/sh
+echo 1..4
+echo "ok - good"
+echo "ok 2 # SKIP"
+echo "not ok 3 # TODO"
+echo ok
+END
+chmod a+x bar.f-o-o
+
+cat > zardoz.l!Nu.x << 'END'
+#! /bin/sh
+echo Hello Zardoz
+exit 0
+END
+chmod a+x zardoz.l!Nu.x
+
+count_all ()
+{
+  count_test_results total=6 pass=3 fail=0 skip=1 xfail=2 xpass=0 error=0
+  grep '^PASS: address@hidden'                 stdout
+  grep '^XFAIL: zardoz.l!Nu\.x$'        stdout
+  grep '^PASS: bar\.f-o-o 1 - good'     stdout
+  grep '^SKIP: bar\.f-o-o 2 # SKIP'     stdout
+  grep '^XFAIL: bar\.f-o-o 3 # TODO'    stdout
+  grep '^PASS: bar\.f-o-o 4$'           stdout
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+st=0; $MAKE check >stdout || st=$?
+cat stdout
+ls -l
+cat test-suite.log
+cat foo.log
+grep '@K @K @K' foo.log
+cat bar.log
+cat zardoz.log
+grep 'Hello Zardoz' zardoz.log && Exit 1
+test $st -eq 0 || Exit 1
+count_all
+
+$MAKE clean
+test ! -f test-suite.log
+test ! -f foo.log
+test ! -f bar.log
+test ! -f zardoz.log
+
+st=0
+$MAKE check TESTS=zardoz L!NU.X_LOG_COMPILER=/bin/sh >stdout || st=$?
+cat stdout
+count_test_results total=1 pass=0 fail=0 skip=0 xfail=0 xpass=1 error=0
+cat test-suite.log
+test ! -f foo.log
+test ! -f bar.log
+cat zardoz.log
+grep 'Hello Zardoz' zardoz.log
+test $st -gt 0 || Exit 1
+
+$MAKE recheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=1 pass=0 fail=0 skip=0 xfail=1 xpass=0 error=0
+grep '^XFAIL: zardoz.l!Nu\.x$' stdout
+
+$MAKE recheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=0 pass=0 fail=0 skip=0 xfail=0 xpass=0 error=0
+
+$MAKE distcheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_all
+
+:
-- 
1.7.9.5




reply via email to

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