In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b5b7b9adf9fbdc829b735710863e92d10a0676b8?hp=5d8ab95357a99a13e919b0e5c19f9a7abb06167d>
- Log ----------------------------------------------------------------- commit b5b7b9adf9fbdc829b735710863e92d10a0676b8 Author: Nicholas Clark <[email protected]> Date: Mon Mar 7 16:31:05 2011 +0000 Simplify the startup skip logic of tests in t/uni. Use the various skip_all*() functions in test.pl to express the desired intent. M t/uni/chomp.t M t/uni/chr.t M t/uni/greek.t M t/uni/latin2.t M t/uni/tr_7jis.t M t/uni/tr_eucjp.t M t/uni/tr_sjis.t M t/uni/tr_utf8.t M t/uni/write.t commit e05e9c3d01e748834948a3f9f9f62c9e72295130 Author: Nicholas Clark <[email protected]> Date: Mon Mar 7 13:33:48 2011 +0000 Add skip_all_without_perlio() to test.pl, and use it in 8 tests. It's a common idiom in the tests. This makes it easier to find, read, and remove. M t/io/crlf.t M t/io/layers.t M t/io/perlio.t M t/io/perlio_fail.t M t/io/perlio_open.t M t/io/utf8.t M t/op/incfilter.t M t/run/switchC.t M t/test.pl commit b6ae43b72863e12dd1cfc7eb414a05d61a20d8bd Author: Nicholas Clark <[email protected]> Date: Mon Mar 7 12:05:14 2011 +0000 Fix building with -Uuseperlio It was inadvertently broken by 2e0cfa16dea85dd3. Many tests still fail, but that is unrelated to that change. It's more likely that we will remove -Uuseperlio than fix the tests. M util.c commit 62e452a49a5581bd1de0a5f26274253ee67aa67e Author: Nicholas Clark <[email protected]> Date: Mon Mar 7 11:00:53 2011 +0000 Refactor 6 tests in t/op and t/run to use skip_all_if_miniperl(). M t/op/attrhand.t M t/op/attrs.t M t/op/incfilter.t M t/op/threads-dirh.t M t/op/threads.t M t/run/switchC.t ----------------------------------------------------------------------- Summary of changes: t/io/crlf.t | 8 +++----- t/io/layers.t | 2 +- t/io/perlio.t | 5 +---- t/io/perlio_fail.t | 2 +- t/io/perlio_open.t | 2 +- t/io/utf8.t | 7 ++----- t/op/attrhand.t | 5 +---- t/op/attrs.t | 5 +---- t/op/incfilter.t | 12 +++--------- t/op/threads-dirh.t | 5 +---- t/op/threads.t | 5 +---- t/run/switchC.t | 15 ++++----------- t/test.pl | 4 ++++ t/uni/chomp.t | 22 ++++------------------ t/uni/chr.t | 23 ++++------------------- t/uni/greek.t | 28 ++++++---------------------- t/uni/latin2.t | 28 ++++++---------------------- t/uni/tr_7jis.t | 22 ++++------------------ t/uni/tr_eucjp.t | 22 ++++------------------ t/uni/tr_sjis.t | 22 ++++------------------ t/uni/tr_utf8.t | 26 ++++---------------------- t/uni/write.t | 14 +++----------- util.c | 4 ++++ 23 files changed, 67 insertions(+), 221 deletions(-) diff --git a/t/io/crlf.t b/t/io/crlf.t index 7eb9a78..ff0f208 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -3,15 +3,16 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(. ../lib); + require "test.pl"; + skip_all_without_perlio(); } use Config; -require "test.pl"; my $file = tempfile(); -if (find PerlIO::Layer 'perlio') { +{ plan(tests => 16); ok(open(FOO,">:crlf",$file)); ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO)); @@ -70,9 +71,6 @@ if (find PerlIO::Layer 'perlio') { } } } -else { - skip_all("No perlio, so no :crlf"); -} sub count_chars { my($text, $chars) = @_; diff --git a/t/io/layers.t b/t/io/layers.t index cb7cbef..4e42043 100644 --- a/t/io/layers.t +++ b/t/io/layers.t @@ -6,7 +6,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - skip_all('not perlio') unless (find PerlIO::Layer 'perlio'); + skip_all_without_perlio(); # FIXME - more of these could be tested without Encode or full perl skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); skip_all_without_extension('Encode'); diff --git a/t/io/perlio.t b/t/io/perlio.t index 8b1cff3..1a330f4 100644 --- a/t/io/perlio.t +++ b/t/io/perlio.t @@ -2,11 +2,8 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require Config; import Config; - unless (find PerlIO::Layer 'perlio') { - print "1..0 # Skip: PerlIO not used\n"; - exit 0; - } require './test.pl'; + skip_all_without_perlio(); } plan tests => 42; diff --git a/t/io/perlio_fail.t b/t/io/perlio_fail.t index 56e3d1d..6bc9b17 100644 --- a/t/io/perlio_fail.t +++ b/t/io/perlio_fail.t @@ -4,7 +4,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require "../t/test.pl"; - skip_all("No perlio") unless (find PerlIO::Layer 'perlio'); + skip_all_without_perlio(); plan (15); } diff --git a/t/io/perlio_open.t b/t/io/perlio_open.t index 7bd9a70..9969796 100644 --- a/t/io/perlio_open.t +++ b/t/io/perlio_open.t @@ -4,7 +4,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - skip_all('not perlio') unless (find PerlIO::Layer 'perlio'); + skip_all_without_perlio(); skip_all_if_miniperl("no dynamic loading on miniperl, no Fcntl"); skip_all_without_extension('Fcntl'); # how did you get this far? } diff --git a/t/io/utf8.t b/t/io/utf8.t index 07f829b..4b01747 100644 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -3,15 +3,12 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; - unless (find PerlIO::Layer 'perlio') { - print "1..0 # Skip: not perlio\n"; - exit 0; - } + require './test.pl'; + skip_all_without_perlio(); } no utf8; # needed for use utf8 not griping about the raw octets -BEGIN { require "./test.pl"; } plan(tests => 55); diff --git a/t/op/attrhand.t b/t/op/attrhand.t index 8c89f7f..996d572 100644 --- a/t/op/attrhand.t +++ b/t/op/attrhand.t @@ -1,13 +1,10 @@ #!/usr/bin/perl -w BEGIN { - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # skip: miniperl can't load attributes\n"; - exit 0; - } chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; + skip_all_if_miniperl("miniperl can't load attributes"); } plan tests => 4; diff --git a/t/op/attrs.t b/t/op/attrs.t index d568af6..89becf6 100644 --- a/t/op/attrs.t +++ b/t/op/attrs.t @@ -3,13 +3,10 @@ # Regression tests for attributes.pm and the C< : attrs> syntax. BEGIN { - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # skip: miniperl can't load attributes\n"; - exit 0; - } chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; + skip_all_if_miniperl("miniperl can't load attributes"); } use warnings; diff --git a/t/op/incfilter.t b/t/op/incfilter.t index 0b763e4..74675a2 100644 --- a/t/op/incfilter.t +++ b/t/op/incfilter.t @@ -5,15 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(. ../lib); - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl\n"; - exit 0; - } - unless (find PerlIO::Layer 'perlio') { - print "1..0 # Skip: not perlio\n"; - exit 0; - } - require "test.pl"; + require 'test.pl'; + skip_all_if_miniperl('no dynamic loading on miniperl, no Filter::Util::Call'); + skip_all_without_perlio(); } use strict; use Config; diff --git a/t/op/threads-dirh.t b/t/op/threads-dirh.t index 616aa6b..900a62a 100644 --- a/t/op/threads-dirh.t +++ b/t/op/threads-dirh.t @@ -13,10 +13,7 @@ BEGIN { print "1..0 # Skip: no ithreads\n"; exit 0; } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no threads\n"; - exit 0; - } + skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); plan(6); } diff --git a/t/op/threads.t b/t/op/threads.t index 4b731f0..94dad6e 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -11,10 +11,7 @@ BEGIN { print "1..0 # Skip: no ithreads\n"; exit 0; } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no threads\n"; - exit 0; - } + skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); plan(24); } diff --git a/t/run/switchC.t b/t/run/switchC.t index b6231ca..5223b00 100644 --- a/t/run/switchC.t +++ b/t/run/switchC.t @@ -5,18 +5,11 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; - unless (find PerlIO::Layer 'perlio') { - print "1..0 # Skip: not perlio\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip : -C and \$ENV{PERL_UNICODE} are disabled on miniperl\n"; - exit 0; - } - -} + require "./test.pl"; -BEGIN { require "./test.pl"; } + skip_all_without_perlio(); + skip_all_if_miniperl('-C and $ENV{PERL_UNICODE} are disabled on miniperl'); +} plan(tests => 13); diff --git a/t/test.pl b/t/test.pl index 9958356..a09c831 100644 --- a/t/test.pl +++ b/t/test.pl @@ -132,6 +132,10 @@ sub skip_all_without_extension { skip_all("$extension was not built"); } +sub skip_all_without_perlio { + skip_all('no PerlIO') unless PerlIO::Layer->find('perlio'); +} + sub _ok { my ($pass, $where, $name, @mess) = @_; # Do not try to microoptimize by factoring out the "not ". diff --git a/t/uni/chomp.t b/t/uni/chomp.t index 6aef50c..1292fb6 100644 --- a/t/uni/chomp.t +++ b/t/uni/chomp.t @@ -1,25 +1,11 @@ #!./perl -w BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/chr.t b/t/uni/chr.t index 8d7924f..227dc52 100644 --- a/t/uni/chr.t +++ b/t/uni/chr.t @@ -1,26 +1,11 @@ #!./perl -w BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; - require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/greek.t b/t/uni/greek.t index a8102f3..a1ca3c4 100644 --- a/t/uni/greek.t +++ b/t/uni/greek.t @@ -1,27 +1,11 @@ +#!./perl -w + BEGIN { - if ($ENV{'PERL_CORE'}){ - chdir 't'; - @INC = '../lib'; - } - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } plan tests => 72; diff --git a/t/uni/latin2.t b/t/uni/latin2.t index 08928b6..344d1a8 100644 --- a/t/uni/latin2.t +++ b/t/uni/latin2.t @@ -1,27 +1,11 @@ +#!./perl -w + BEGIN { - if ($ENV{'PERL_CORE'}){ - chdir 't'; - @INC = '../lib'; - } - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } plan tests => 94; diff --git a/t/uni/tr_7jis.t b/t/uni/tr_7jis.t index 46f80a1..90f3431 100644 --- a/t/uni/tr_7jis.t +++ b/t/uni/tr_7jis.t @@ -5,25 +5,11 @@ # -- dankogai BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/tr_eucjp.t b/t/uni/tr_eucjp.t index 6b2ca2b..352684d 100644 --- a/t/uni/tr_eucjp.t +++ b/t/uni/tr_eucjp.t @@ -4,25 +4,11 @@ # -- dankogai BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/tr_sjis.t b/t/uni/tr_sjis.t index d71c4ba..fca9d6c 100644 --- a/t/uni/tr_sjis.t +++ b/t/uni/tr_sjis.t @@ -4,25 +4,11 @@ # -- dankogai BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/tr_utf8.t b/t/uni/tr_utf8.t index 8e697ce..aa8f439 100644 --- a/t/uni/tr_utf8.t +++ b/t/uni/tr_utf8.t @@ -5,29 +5,11 @@ # -- dankogai BEGIN { - if ($ENV{'PERL_CORE'}){ - chdir 't'; - @INC = '../lib'; - } - require Config; import Config; - if ($Config{'extensions'} !~ /\bEncode\b/) { - print "1..0 # Skip: Encode was not built\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC\n"; - exit 0; - } - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if ($ENV{PERL_CORE_MINITEST}) { - print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n"; - exit 0; - } - $| = 1; require './test.pl'; + skip_all_if_miniperl("no dynamic loading on miniperl, no Encode"); + skip_all("EBCDIC") if $::IS_EBCDIC; + skip_all_without_perlio(); + skip_all_without_extension('Encode'); } use strict; diff --git a/t/uni/write.t b/t/uni/write.t index 136be67..c60065d 100644 --- a/t/uni/write.t +++ b/t/uni/write.t @@ -2,17 +2,9 @@ use strict; BEGIN { - chdir 't' if -d 't'; - @INC = qw(../lib .); - require "test.pl"; - unless (PerlIO::Layer->find('perlio')){ - print "1..0 # Skip: PerlIO required\n"; - exit 0; - } - if (ord("A") == 193) { - print "1..0 # Skip: EBCDIC porting needed\n"; - exit 0; - } + require './test.pl'; + skip_all("EBCDIC porting needed") if $::IS_EBCDIC; + skip_all_without_perlio(); } plan tests => 6; diff --git a/util.c b/util.c index dabc062..0ea39c6 100644 --- a/util.c +++ b/util.c @@ -3127,9 +3127,13 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) dSAVEDERRNO; const int fd = PerlIO_fileno(ptr); +#ifdef USE_PERLIO /* Find out whether the refcount is low enough for us to wait for the child proc without blocking. */ const bool should_wait = PerlIOUnix_refcnt(fd) == 1; +#else + const bool should_wait = 1; +#endif svp = av_fetch(PL_fdpid,fd,TRUE); pid = (SvTYPE(*svp) == SVt_IV) ? SvIVX(*svp) : -1; -- Perl5 Master Repository
