From: Stefano Lattarini Date: Tue, 22 May 2012 16:28:49 +0000 (+0200) Subject: [ng] check: be laxer in accepted $(TEST_EXTENSIONS) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a9f7b596c1e94eb90d07e09af6dc4bad1b771a9;p=thirdparty%2Fautomake.git [ng] check: be laxer in accepted $(TEST_EXTENSIONS) 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 dot, in addition to the @EXEEXT@ substitution. * t/test-extensions-funny-chars.sh: New test. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index ed1c12b3e..87285e11a 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 000000000..d189bfe6b --- /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 . + +# 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 +@_LOG_COMPILER = $(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: foo\.@$' 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 + +: