On 01/05/2012 10:54 PM, Peter Rosin wrote: > Hi! > Hi Peter, and thanks for your relentless testing on MinGW/MSYS.
> I tried make check on MSYS with the current master, and among other > things, this problem stands out as it FAILs so many test cases. > > I'm using tap-bailout-w.test as an example, no use reporting the > same problem 80+ times, right :-) > > The perl version is 5.8.8 > > Here's tap-bailout-w.log: > > ./tap-bailout-w.test: will source ./tap-bailout.test > Running from installcheck: no > Using TAP: no > > [SNIP] > > ++ TESTS='a.test b.test c.test d.test e.test' > ++ make -e check > Can't locate TAP/Parser.pm in @INC (@INC contains: /usr/lib/perl5/5.8/msys > /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/msys > /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/site_perl/5.8 > /usr/lib/perl5/vendor_perl/5.8/msys /usr/lib/perl5/vendor_perl/5.8 > /usr/lib/perl5/vendor_perl/5.8 .) at ./tap-driver line 33. > BEGIN failed--compilation aborted at ./tap-driver line 33. > make[2]: *** [a.log] Error 2 > make[1]: *** [check-TESTS] Error 2 > make: *** [check-am] Error 2 > Bummer. I had taken for granted that all perl installations modern enough to correctly run automake also came with a built-int TAP::Parser module -- but it seems this is not the case after all. Anyway, since the perl implementation of the TAP driver is meant to be used only for prototyping and consistency checks (the "real" TAP driver being the portable one implemented in awk), this is not a big deal, and we just need to skip the affected tests on systems lacking TAP::Parser. Could you verify that the attached patch solves the issue? I've tested it by putting a broken TAP::Parser early in @INC, so it should work; but as you know there is no substitute to testing with the "real thing". Thanks, Stefano
>From 9cbc0a359cff1378d90f1bc71cff25ee616fa662 Mon Sep 17 00:00:00 2001 Message-Id: <9cbc0a359cff1378d90f1bc71cff25ee616fa662.1325853223.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Fri, 6 Jan 2012 12:39:24 +0100 Subject: [PATCH] tests: skip tests on perl TAP driver if TAP::Parser module not available Fixes automake bug#10440. * tests/defs (fetch_tap_driver): Skip the whole test case if the desired tap driver implementation is the perl one but the TAP::Parser module is unavailable. * tests/tap-bad-prog.tap: Adjust order of calls to `plan_' and `fetch_tap_driver', to ensure the test is not skipped after the TAP plan has been outputted (which would lead to a spurious error). * tests/tap-bad-signal.tap: Tweak to avoid the need to source the `tap-setup.sh' script, as that might cause a test skip too late, i.e., after a TAP plan has been already printed. * tests/tap-test-number-0.test: Do not force the test to skip when the tested TAP driver implementation is not the perl one. On the other hand, when it *is* the perl one, skip the test if the TAP::Parser module is unavailable. * tests/test-driver-cond.test: Skip the part of the test actually running "make check" if the TAP::Parser module is unavailable. * tests/get-sysconf.test: Also print the version of the `TAP::Parser' module, if available. Reported by Peter Rosin. --- tests/defs | 14 +++++++++----- tests/get-sysconf.test | 6 +++++- tests/tap-bad-prog.tap | 6 +++--- tests/tap-signal.tap | 15 +++++++++++++-- tests/tap-test-number-0.test | 40 ++++++++++++++++++++++------------------ tests/test-driver-cond.test | 5 ++++- 6 files changed, 56 insertions(+), 30 deletions(-) diff --git a/tests/defs b/tests/defs index 835788d..41ee262 100644 --- a/tests/defs +++ b/tests/defs @@ -1,8 +1,8 @@ # -*- shell-script -*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. +# 2005, 2006, 2007, 2008, 2009, 2010, 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 @@ -602,12 +602,16 @@ fetch_tap_driver () # TODO: with /bin/sh, for better coverage. case $am_tap_implementation in perl) - sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl ;; + $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) - sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh ;; + sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver + ;; *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;; - esac > tap-driver \ + esac \ && chmod a+x tap-driver \ || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver" sed 10q tap-driver # For debugging. diff --git a/tests/get-sysconf.test b/tests/get-sysconf.test index 039a436..789a015 100755 --- a/tests/get-sysconf.test +++ b/tests/get-sysconf.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# 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 @@ -37,6 +37,10 @@ else ' "$top_testsrcdir"/ChangeLog || st=1 fi $PERL -V || st=1 +# It's OK for the user not to have the TAP::Parser module; this can +# happen with older perl installation, or on MinGW/MSYS. +$PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || : + cat "$top_testbuilddir/config.log" || st=1 cat "$testbuilddir/aclocal-$APIVERSION" || st=1 cat "$testbuilddir/automake-$APIVERSION" || st=1 diff --git a/tests/tap-bad-prog.tap b/tests/tap-bad-prog.tap index a59a1dc..212633f 100755 --- a/tests/tap-bad-prog.tap +++ b/tests/tap-bad-prog.tap @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# 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 @@ -21,10 +21,10 @@ am_parallel_tests=yes . ./defs || Exit 1 -plan_ 5 - fetch_tap_driver +plan_ 5 + cat >> configure.in <<END AC_OUTPUT END diff --git a/tests/tap-signal.tap b/tests/tap-signal.tap index 0ed7194..f436bc8 100755 --- a/tests/tap-signal.tap +++ b/tests/tap-signal.tap @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# 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 @@ -20,9 +20,16 @@ am_parallel_tests=yes . ./defs || Exit 1 +fetch_tap_driver + plan_ 10 +cat >> configure.in <<END +AC_OUTPUT +END + cat > Makefile.am << END +TEST_LOG_DRIVER = \$(srcdir)/tap-driver TEST_LOG_COMPILER = $PERL -w ## Will be updated later. TESTS = @@ -58,7 +65,11 @@ results_count=`ls *.test | wc -l | tr -d "$tab$sp"` chmod a+x *.test -. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure signal_caught () { diff --git a/tests/tap-test-number-0.test b/tests/tap-test-number-0.test index 8a117ce..6e77a5d 100755 --- a/tests/tap-test-number-0.test +++ b/tests/tap-test-number-0.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# 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 @@ -21,23 +21,27 @@ am_parallel_tests=yes . ./defs || Exit 1 -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" +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 . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" diff --git a/tests/test-driver-cond.test b/tests/test-driver-cond.test index 3ed48a9..46986ff 100755 --- a/tests/test-driver-cond.test +++ b/tests/test-driver-cond.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# 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 @@ -87,6 +87,9 @@ grep '^my_LOG_DRIVER *=' Makefile.in \ grep '^TEST_LOG_DRIVER =.*\$(SHELL).*/test-driver' Makefile.in +$PERL -MTAP::Parser -e 1 \ + || skip_ "cannot import TAP::Parser perl module" + ./configure do_count () -- 1.7.7.3