diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-12-24 16:27:28 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-12-24 16:50:03 +0100 |
commit | a6d6734fca39448770365e77acb562e6c42a7ea2 (patch) | |
tree | 036bc50503ae9a0a1a30d483dbc3553cf0f3b7a4 | |
parent | 526c4b04a699fd62da6bc3915cdb333f0a6ca92d (diff) | |
download | automake-a6d6734fca39448770365e77acb562e6c42a7ea2.tar.gz |
TAP driver: remove perl implementation (move it into contrib/)
That implementation was only meant as a standard against which the
portable awk+shell implementation was to be measured. Now, since
Automake 1.12, the latter implementation is fully functional and
already used in the wild, and in fact feature-par with the perl
implementation. So the perl implementation is now just slowing
down and complicating our testsuite. Let's move it to 'contrib/'
(we don't want to remove it, in case someone is actually using it
in the wild).
* lib/tap-driver.pl: Move it ...
* contrib/tap-driver.pl: ... here. While at it, convert quoting
`like this' to quoting 'like this', and remove an obsolescent FIXME
comment.
* lib/Makefile.inc (dist_script_DATA): Drop '%D%/tap-driver.pl'.
* Makefile.am (EXTRA_DIST): Add 'contrib/tap-driver.pl'.
* doc/automake.texi: Remove one stray reference to 'tap-driver.pl',
and reference 'tap-driver.sh' instead, as intended.
* t/ax/am-test-lib.sh ($am_tap_implementation): Delete definition and
uses.
(fetch_tap_driver): Simplify to unconditionally assume the shell+awk
implementation of the TAP driver is used.
(get_shell_script): Make more flexible so that it can cater to the
needs of 'fetch_tap_driver()'.
* t/tap-bad-prog.tap: Likewise.
* t/tap-bailout-leading-space.sh: Likewise.
* t/tap-signal.tap: Likewise.
* t/tap-test-number-0.sh: Likewise.
* t/test-driver-cond.sh: Use 'tap-driver.sh' instead of 'tap-driver.pl'.
* gen-testsuite-part (%test_generators): Do not generate sister tests
that use the perl TAP driver rather than the shell+awk one.
* NEWS: Update.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | NEWS | 9 | ||||
-rwxr-xr-x | contrib/tap-driver.pl (renamed from lib/tap-driver.pl) | 9 | ||||
-rw-r--r-- | doc/automake.texi | 2 | ||||
-rwxr-xr-x | gen-testsuite-part | 14 | ||||
-rw-r--r-- | lib/Makefile.inc | 3 | ||||
-rw-r--r-- | t/ax/am-test-lib.sh | 53 | ||||
-rw-r--r-- | t/tap-bad-prog.tap | 30 | ||||
-rw-r--r-- | t/tap-bailout-leading-space.sh | 9 | ||||
-rw-r--r-- | t/tap-signal.tap | 9 | ||||
-rw-r--r-- | t/tap-test-number-0.sh | 24 | ||||
-rw-r--r-- | t/test-driver-cond.sh | 8 |
12 files changed, 47 insertions, 124 deletions
diff --git a/Makefile.am b/Makefile.am index 143308a11..f8b6ac5c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -92,6 +92,7 @@ ChangeLog: # Third-party, obsolescent or experimental stuff. EXTRA_DIST += \ + contrib/tap-driver.pl \ contrib/check-html.am \ contrib/multilib/README \ contrib/multilib/config-ml.in \ @@ -73,6 +73,15 @@ New in 1.15: (3) the "set -f" and "set +f" shell commands work, and, respectively, disable and enable shell globbing. +* Automake-generated testsuite: + + - The perl implementation of the TAP testsuite driver is no longer + installed in the Automake's scripts directory, and is instead just + distributed as a "contrib" addition. There should be no reason to + use this implementation anyway in real packages, since the awk+shell + implementation of the TAP driver (that is documented in the manual) + is more portable and has feature parity with the perl implementation. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.14.1: diff --git a/lib/tap-driver.pl b/contrib/tap-driver.pl index aca65fe44..e7e581de4 100755 --- a/lib/tap-driver.pl +++ b/contrib/tap-driver.pl @@ -32,7 +32,7 @@ use strict; use Getopt::Long (); use TAP::Parser; -my $VERSION = '2012-02-01.19'; # UTC +my $VERSION = '2013-12-24.15'; # UTC my $ME = "tap-driver.pl"; @@ -43,13 +43,13 @@ Usage: [--enable-hard-errors={yes|no}] [--ignore-exit] [--diagnostic-string=STRING] [--merge|--no-merge] [--comments|--no-comments] [--] TEST-COMMAND -The `--test-name', `--log-file' and `--trs-file' options are mandatory. +The '--test-name', '--log-file' and '--trs-file' options are mandatory. END my $HELP = "$ME: TAP-aware test driver for Automake testsuite harness." . "\n" . $USAGE; -# Keep this in sync with `lib/am/check.am:$(am__tty_colors)'. +# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. my %COLOR = ( red => "\e[0;31m", grn => "\e[0;32m", @@ -208,7 +208,6 @@ TEST_RESULTS : return grep { not $_ eq "PASS" } (keys %test_results_seen); } - # FIXME: this can certainly be improved ... sub get_global_test_result () { return "ERROR" @@ -465,7 +464,7 @@ sub extract_tap_comment ($) my $line = shift; if (index ($line, $diag_string) == 0) { - # Strip leading `$diag_string' from `$line'. + # Strip leading '$diag_string' from '$line'. $line = substr ($line, length ($diag_string)); # And strip any leading and trailing whitespace left. $line =~ s/(?:^\s*|\s*$)//g; diff --git a/doc/automake.texi b/doc/automake.texi index cd33ad7c3..74a410177 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -9742,7 +9742,7 @@ echo ok 1 # Exit with error, even if all the tests have been successful. exit 7 -% @kbd{cp @var{PREFIX}/share/automake-@var{APIVERSION}/tap-driver.pl .} +% @kbd{cp @var{PREFIX}/share/automake-@var{APIVERSION}/tap-driver.sh .} % @kbd{autoreconf -vi && ./configure && make check} ... PASS: foo.test 1 - Swallows fly diff --git a/gen-testsuite-part b/gen-testsuite-part index 3bd5c9f01..5bd1b4e96 100755 --- a/gen-testsuite-part +++ b/gen-testsuite-part @@ -241,20 +241,6 @@ my %test_generators = shell_setup_code => 'am_test_prefer_config_shell=yes', }, - # - # Tests on tap support should be run with both the perl and awk - # implementations of the TAP driver (they run with the awk one - # by default). - # - perl_tap_driver => - { - line_matcher => - qr<(?:\bfetch_tap_driver\b|[\s/]tap-setup\.sh\b)>, - line_rejecter => - qr/\bam_tap_implementation=/, - shell_setup_code => - 'am_tap_implementation=perl', - }, ); #-------------------------------------------------------------------------- diff --git a/lib/Makefile.inc b/lib/Makefile.inc index d1971f55f..8eed3038e 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -40,8 +40,7 @@ dist_script_DATA = \ %D%/py-compile \ %D%/ar-lib \ %D%/test-driver \ - %D%/tap-driver.sh \ - %D%/tap-driver.pl + %D%/tap-driver.sh install-data-hook: @$(POST_INSTALL) diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh index 26e58ef04..cee5c8da8 100644 --- a/t/ax/am-test-lib.sh +++ b/t/ax/am-test-lib.sh @@ -583,17 +583,31 @@ count_test_results () # of /bin/sh. get_shell_script () { - test ! -f "$1" || rm -f "$1" || return 99 + am_source=$1 am_target=${2-$1} + test ! -f "$am_target" || rm -f "$am_target" || return 99 if test x"$am_test_prefer_config_shell" = x"yes"; then - sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \ - && chmod a+x "$1" \ + sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$am_source" > "$am_target" \ + && chmod a+x "$am_target" \ || return 99 else - cp -f "$am_scriptdir/$1" . || return 99 + cp -f "$am_scriptdir/$am_source" "$am_target" || return 99 fi - sed 10q "$1" # For debugging. + sed 10q "$am_target" # For debugging. + unset am_target am_source } +# fetch_tap_driver +# ---------------- +# Fetch the Automake-provided TAP driver from the 'lib/' directory into +# the current directory, and edit its shebang line so that it will be +# run with the proper shell. +fetch_tap_driver () +{ + AM_TAP_AWK=$AWK; export AM_TAP_AWK + get_shell_script tap-driver.sh tap-driver +} + + # require_xsi SHELL # ----------------- # Skip the test if the given shell fails to support common XSI constructs. @@ -612,35 +626,6 @@ xsi_shell_code=' && eval '\''test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5'\' -# fetch_tap_driver -# ---------------- -# Fetch the Automake-provided TAP driver from the 'lib/' directory into -# the current directory, and edit its shebang line so that it will be -# run with the perl interpreter determined at configure time. -fetch_tap_driver () -{ - # TODO: we should devise a way to make the shell TAP driver tested also - # TODO: with /bin/sh, for better coverage. - case $am_tap_implementation in - # Extra quoting required to avoid maintainer-check spurious failures. - 'perl') - $PERL -MTAP::Parser -e 1 \ - || skip_all_ "cannot import TAP::Parser perl module" - sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver - ;; - shell) - AM_TAP_AWK=$AWK; export AM_TAP_AWK - sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver - ;; - *) - fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;; - esac \ - && chmod a+x tap-driver \ - || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver" - sed 10q tap-driver # For debugging. -} -am_tap_implementation=${am_tap_implementation-shell} - # $PYTHON and support for PEP-3147. Needed to check our python-related # install rules. python_has_pep3147 () diff --git a/t/tap-bad-prog.tap b/t/tap-bad-prog.tap index 490cd4a78..9225c38ed 100644 --- a/t/tap-bad-prog.tap +++ b/t/tap-bad-prog.tap @@ -73,35 +73,13 @@ else fi # Check that no spurious test result is reported. This is lower-priority -# (and in fact the check currently fails for our awk-based driver). -directive= -if test $am_tap_implementation = shell; then - directive=TODO -else - # Older versions of IPC::Open3 (e.g., version 1.05 on perl 5.12.4 or - # version 1.0103 on perl 5.6.2) fail to properly trap errors in exec(2) - # calls in the child process; hence, the TAP driver cannot be properly - # informed of such error. - if $PERL -w -e ' - use IPC::Open3 qw/open3/; - $@ = ""; - eval { open3(*STDIN, *STDOUT, *STDERR, "am--no-such-command") }; - $@ =~ m/\bopen3:.*am--no-such-command/ - or die "Bad \$@ value: \"$@\"\n"; - '; then - : # OK. IPC::Open3 should be good enough. - else - for s in '"missing plan" message' 'results'; do - skip_ -r "IPC::Open3 not good enough" "no spurious $s" - done - exit 0 - fi -fi +# (and in fact the check currently fails). command_ok_ 'no spurious "missing plan" message' \ - -D "$directive" -- not grep 'missing.* plan' stdout + -D TODO -- not grep 'missing.* plan' stdout + command_ok_ 'no spurious results' \ - -D "$directive" -r 'still get "missing plan"' \ + -D TODO -r 'still get "missing plan"' \ count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=3 : diff --git a/t/tap-bailout-leading-space.sh b/t/tap-bailout-leading-space.sh index 120ae0340..7a55a1fba 100644 --- a/t/tap-bailout-leading-space.sh +++ b/t/tap-bailout-leading-space.sh @@ -14,15 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Older versions of prove and TAP::Harness (e.g., 3.17) didn't recognize -# a "Bail out!" directive that was preceded by whitespace, but more modern -# versions (e.g., 3.23) do. So we leave this behaviour undefined for the -# perl implementation of the Automake TAP driver, but expect the latter, -# "more modern" behaviour in our awk TAP driver. +# A "Bail out!" directive that is preceded by whitespace should still +# be recognized. -am_tap_implementation=shell . test-init.sh - . tap-setup.sh cat > a.test <<END diff --git a/t/tap-signal.tap b/t/tap-signal.tap index f1a81308b..70fe5c19d 100644 --- a/t/tap-signal.tap +++ b/t/tap-signal.tap @@ -93,13 +93,8 @@ signal_caught () esac wbound_re="($|[^a-zA-Z0-9_-])" pfx_re="^ERROR: signal-$numeric\\.test" - case $am_tap_implementation in - # Dummy escape to please maintainer-check. - per\l) rx="$pfx_re - terminated by signal $sig_re$";; - shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";; - *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";; - esac - desc="TAP driver catch test termination by signal SIG$symbolic" + rx="${pfx_re} .*terminated by signal ${sig_re}${wbound_re}" + desc="TAP driver catch test termination by signal SIG${symbolic}" case " $blocked_signals " in *" $numeric "*) skip_ -r "SIG$symbolic is blocked" "$desc" ;; *) command_ok_ "$desc" env LC_ALL=C $EGREP "$rx" stdout ;; diff --git a/t/tap-test-number-0.sh b/t/tap-test-number-0.sh index b5b161b30..d447ebe07 100644 --- a/t/tap-test-number-0.sh +++ b/t/tap-test-number-0.sh @@ -19,30 +19,6 @@ # This is consistent with the behaviour of the 'prove' utility. . test-init.sh - -if test $am_tap_implementation = perl; then - $PERL -MTAP::Parser -e 1 \ - || skip_ "cannot import TAP::Parser perl module" - if $PERL -w -e ' - use warnings FATAL => "all"; use strict; - use TAP::Parser; - my $parser = TAP::Parser->new({tap => "1..1\n" . "ok 0\n"}); - my $result = $parser->next; - $result->is_plan or die "first line is not TAP plan"; - $result = $parser->next; - $result->is_test or die "second line is not TAP test result"; - my $testno = $result->number; - $parser->next and die "unexpected further TAP stream"; - exit ($testno == 0 ? 0 : 77); - '; then - : # Nothing to do. - elif test $? -eq 77; then - skip_ 'TAP::Parser bug: test number 0 gets relabelled as 1' - else - fatal_ "error analyzing TAP::Parser module for bugs" - fi -fi - . tap-setup.sh cat > a.test <<END diff --git a/t/test-driver-cond.sh b/t/test-driver-cond.sh index febb9d2f8..9b50b1c0a 100644 --- a/t/test-driver-cond.sh +++ b/t/test-driver-cond.sh @@ -22,8 +22,8 @@ cp "$am_testaux_srcdir"/trivial-test-driver . \ || fatal_ "failed to fetch auxiliary script trivial-test-driver" -cp "$am_scriptdir"/tap-driver.pl . \ - || fatal_ "failed to fetch auxiliary script tap-driver.pl" +cp "$am_scriptdir"/tap-driver.sh . \ + || fatal_ "failed to fetch auxiliary script tap-driver.sh" cat >> configure.ac << END AM_CONDITIONAL([COND1], [:]) @@ -40,7 +40,7 @@ $AUTOCONF cat > Makefile.am << 'END' TESTS = foo bar.test baz.sh -EXTRA_DIST = $(TESTS) tap-driver.pl trivial-test-driver +EXTRA_DIST = $(TESTS) tap-driver.sh trivial-test-driver TEST_EXTENSIONS = .test .sh LOG_DRIVER = SH_LOG_DRIVER = $(tap_rulez) @@ -49,7 +49,7 @@ LOG_DRIVER += @my_LOG_DRIVER@ if COND2 tap_rulez = false else !COND2 -tap_rulez = $(PERL) $(srcdir)/tap-driver.pl +tap_rulez = $(PERL) $(srcdir)/tap-driver.sh endif !COND2 endif COND1 END |