diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-07-20 11:55:16 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-07-20 11:55:16 +0100 |
commit | 0b4ffce69122f064651915707455a21d480d61c3 (patch) | |
tree | 66d2a5503aeff1ea024379b0903af03f8f48dae2 /cpan/Test-Simple | |
parent | e8d5ab7b269b27852f432c140e9d021f103b50e0 (diff) | |
download | perl-0b4ffce69122f064651915707455a21d480d61c3.tar.gz |
Upgrade Test-Simple from version 1.302040 to 1.302045
Diffstat (limited to 'cpan/Test-Simple')
47 files changed, 433 insertions, 78 deletions
diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm index bc0e095f75..2a1be725fd 100644 --- a/cpan/Test-Simple/lib/Test/Builder.pm +++ b/cpan/Test-Simple/lib/Test/Builder.pm @@ -4,7 +4,7 @@ use 5.006; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { if( $] < 5.008 ) { @@ -69,7 +69,7 @@ sub _add_ts_hooks { return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag'; # Set todo on ok's - if ($hub == $active_hub && $e->isa('Test2::Event::Ok')) { + if ($e->isa('Test2::Event::Ok')) { $e->set_todo($todo); $e->set_effective_pass(1); diff --git a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm index b89beea72d..389597f58d 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm @@ -2,7 +2,7 @@ package Test::Builder::Formatter; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) } diff --git a/cpan/Test-Simple/lib/Test/Builder/Module.pm b/cpan/Test-Simple/lib/Test/Builder/Module.pm index 165b433344..a1434f5392 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Module.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Module.pm @@ -7,7 +7,7 @@ use Test::Builder; require Exporter; our @ISA = qw(Exporter); -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; =head1 NAME diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm index 22003f960c..de5e5e6f18 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Tester.pm @@ -1,7 +1,7 @@ package Test::Builder::Tester; use strict; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test::Builder; use Symbol; diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm index 9e723ee17a..c28e5ad624 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm @@ -1,7 +1,7 @@ package Test::Builder::Tester::Color; use strict; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; require Test::Builder::Tester; diff --git a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm index a5d0f6e135..b716af9356 100644 --- a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm +++ b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm @@ -2,7 +2,7 @@ package Test::Builder::TodoDiag; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) } diff --git a/cpan/Test-Simple/lib/Test/More.pm b/cpan/Test-Simple/lib/Test/More.pm index 01d96533da..66208c4f1a 100644 --- a/cpan/Test-Simple/lib/Test/More.pm +++ b/cpan/Test-Simple/lib/Test/More.pm @@ -17,7 +17,7 @@ sub _carp { return warn @_, " at $file line $line\n"; } -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); diff --git a/cpan/Test-Simple/lib/Test/Simple.pm b/cpan/Test-Simple/lib/Test/Simple.pm index 75820c29f0..273eee76dc 100644 --- a/cpan/Test-Simple/lib/Test/Simple.pm +++ b/cpan/Test-Simple/lib/Test/Simple.pm @@ -4,7 +4,7 @@ use 5.006; use strict; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); diff --git a/cpan/Test-Simple/lib/Test/Tester.pm b/cpan/Test-Simple/lib/Test/Tester.pm index bb93920788..adbaac91cd 100644 --- a/cpan/Test-Simple/lib/Test/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Tester.pm @@ -18,7 +18,7 @@ require Exporter; use vars qw( @ISA @EXPORT ); -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; @EXPORT = qw( run_tests check_tests check_test cmp_results show_space ); @ISA = qw( Exporter ); diff --git a/cpan/Test-Simple/lib/Test/Tester/Capture.pm b/cpan/Test-Simple/lib/Test/Tester/Capture.pm index 0cfa580736..5a440c7f39 100644 --- a/cpan/Test-Simple/lib/Test/Tester/Capture.pm +++ b/cpan/Test-Simple/lib/Test/Tester/Capture.pm @@ -2,7 +2,7 @@ use strict; package Test::Tester::Capture; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test::Builder; diff --git a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm index 91a48ccce1..4c282bf608 100644 --- a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm +++ b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm @@ -3,7 +3,7 @@ use strict; package Test::Tester::CaptureRunner; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test::Tester::Capture; diff --git a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm index 080509e2bc..d3314968aa 100644 --- a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm +++ b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm @@ -3,7 +3,7 @@ use warnings; package Test::Tester::Delegate; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use vars '$AUTOLOAD'; diff --git a/cpan/Test-Simple/lib/Test/use/ok.pm b/cpan/Test-Simple/lib/Test/use/ok.pm index a5899cb6b5..e1e4b98765 100644 --- a/cpan/Test-Simple/lib/Test/use/ok.pm +++ b/cpan/Test-Simple/lib/Test/use/ok.pm @@ -1,7 +1,7 @@ package Test::use::ok; use 5.005; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; __END__ diff --git a/cpan/Test-Simple/lib/Test2.pm b/cpan/Test-Simple/lib/Test2.pm index 0ac6c1cc01..c67ad194fb 100644 --- a/cpan/Test-Simple/lib/Test2.pm +++ b/cpan/Test-Simple/lib/Test2.pm @@ -2,7 +2,7 @@ package Test2; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; 1; diff --git a/cpan/Test-Simple/lib/Test2/API.pm b/cpan/Test-Simple/lib/Test2/API.pm index 0dcf4aa3ab..6f916674e1 100644 --- a/cpan/Test-Simple/lib/Test2/API.pm +++ b/cpan/Test-Simple/lib/Test2/API.pm @@ -2,7 +2,7 @@ package Test2::API; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; my $INST; diff --git a/cpan/Test-Simple/lib/Test2/API/Breakage.pm b/cpan/Test-Simple/lib/Test2/API/Breakage.pm index 93d10c08b7..580e0914f7 100644 --- a/cpan/Test-Simple/lib/Test2/API/Breakage.pm +++ b/cpan/Test-Simple/lib/Test2/API/Breakage.pm @@ -2,7 +2,7 @@ package Test2::API::Breakage; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Util qw/pkg_to_file/; diff --git a/cpan/Test-Simple/lib/Test2/API/Context.pm b/cpan/Test-Simple/lib/Test2/API/Context.pm index 98e5247b1c..6e9362f8c2 100644 --- a/cpan/Test-Simple/lib/Test2/API/Context.pm +++ b/cpan/Test-Simple/lib/Test2/API/Context.pm @@ -2,7 +2,7 @@ package Test2::API::Context; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Carp qw/confess croak longmess/; diff --git a/cpan/Test-Simple/lib/Test2/API/Instance.pm b/cpan/Test-Simple/lib/Test2/API/Instance.pm index 515af627b9..7275e18175 100644 --- a/cpan/Test-Simple/lib/Test2/API/Instance.pm +++ b/cpan/Test-Simple/lib/Test2/API/Instance.pm @@ -2,7 +2,7 @@ package Test2::API::Instance; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/; diff --git a/cpan/Test-Simple/lib/Test2/API/Stack.pm b/cpan/Test-Simple/lib/Test2/API/Stack.pm index 894de47119..ec195537ac 100644 --- a/cpan/Test-Simple/lib/Test2/API/Stack.pm +++ b/cpan/Test-Simple/lib/Test2/API/Stack.pm @@ -2,7 +2,7 @@ package Test2::API::Stack; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Hub(); diff --git a/cpan/Test-Simple/lib/Test2/Event.pm b/cpan/Test-Simple/lib/Test2/Event.pm index 6e1c9253db..83365b567a 100644 --- a/cpan/Test-Simple/lib/Test2/Event.pm +++ b/cpan/Test-Simple/lib/Test2/Event.pm @@ -2,7 +2,7 @@ package Test2::Event; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Util::HashBase qw/trace nested in_subtest subtest_id/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Bail.pm b/cpan/Test-Simple/lib/Test2/Event/Bail.pm index e95890e327..44688b3ee9 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Bail.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Bail.pm @@ -2,7 +2,7 @@ package Test2::Event::Bail; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Diag.pm b/cpan/Test-Simple/lib/Test2/Event/Diag.pm index 66b1ac5c75..afb4d6f626 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Diag.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Diag.pm @@ -2,7 +2,7 @@ package Test2::Event::Diag; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Exception.pm b/cpan/Test-Simple/lib/Test2/Event/Exception.pm index d08bde372f..5e914fcc96 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Exception.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Exception.pm @@ -2,7 +2,7 @@ package Test2::Event::Exception; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Generic.pm b/cpan/Test-Simple/lib/Test2/Event/Generic.pm index 69007a2e1e..4a7d332799 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Generic.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Generic.pm @@ -5,7 +5,7 @@ use warnings; use Carp qw/croak/; use Scalar::Util qw/reftype/; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase; diff --git a/cpan/Test-Simple/lib/Test2/Event/Info.pm b/cpan/Test-Simple/lib/Test2/Event/Info.pm index 656e272c55..029ab548f3 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Info.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Info.pm @@ -4,7 +4,7 @@ use warnings; use Scalar::Util qw/blessed/; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase qw/diagnostics renderer/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Note.pm b/cpan/Test-Simple/lib/Test2/Event/Note.pm index 1425ce4e31..c2772963b7 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Note.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Note.pm @@ -2,7 +2,7 @@ package Test2::Event::Note; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Ok.pm b/cpan/Test-Simple/lib/Test2/Event/Ok.pm index 2b8c31e266..341dc0648f 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Ok.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Ok.pm @@ -2,7 +2,7 @@ package Test2::Event::Ok; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Plan.pm b/cpan/Test-Simple/lib/Test2/Event/Plan.pm index a7d51b3df8..904f6e9867 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Plan.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Plan.pm @@ -2,7 +2,7 @@ package Test2::Event::Plan; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Skip.pm b/cpan/Test-Simple/lib/Test2/Event/Skip.pm index 71a0a2238d..9b7aa64f12 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Skip.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Skip.pm @@ -2,7 +2,7 @@ package Test2::Event::Skip; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm index 45efddb16b..45ba0f5eaa 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Event::Subtest; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm index fb41f14d12..15db583976 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm @@ -2,7 +2,7 @@ package Test2::Event::Waiting; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Formatter.pm b/cpan/Test-Simple/lib/Test2/Formatter.pm index e258651624..77d023d8c9 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter.pm @@ -2,7 +2,7 @@ package Test2::Formatter; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; my %ADDED; diff --git a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm index 9243069fde..09211f05f9 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm @@ -3,7 +3,7 @@ use strict; use warnings; require PerlIO; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Util::HashBase qw{ diff --git a/cpan/Test-Simple/lib/Test2/Hub.pm b/cpan/Test-Simple/lib/Test2/Hub.pm index d1ba5319bf..707c585ae0 100644 --- a/cpan/Test-Simple/lib/Test2/Hub.pm +++ b/cpan/Test-Simple/lib/Test2/Hub.pm @@ -2,7 +2,7 @@ package Test2::Hub; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Carp qw/carp croak confess/; diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm index d9dec73c6e..f81284db7a 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Hub::Interceptor::Terminator(); diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm index 1fa89130fc..166627482a 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor::Terminator; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; 1; diff --git a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm index 96338c22b2..835090a6d2 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Hub::Subtest; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } diff --git a/cpan/Test-Simple/lib/Test2/IPC.pm b/cpan/Test-Simple/lib/Test2/IPC.pm index 4fa952d009..c09293a050 100644 --- a/cpan/Test-Simple/lib/Test2/IPC.pm +++ b/cpan/Test-Simple/lib/Test2/IPC.pm @@ -2,7 +2,7 @@ package Test2::IPC; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::API::Instance; diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm index 2e06eab097..521e4ce98f 100644 --- a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm +++ b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm @@ -2,7 +2,7 @@ package Test2::IPC::Driver; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Carp qw/confess longmess/; diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm index 5c9740d275..7cf62c8648 100644 --- a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm +++ b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm @@ -2,7 +2,7 @@ package Test2::IPC::Driver::Files; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) } @@ -18,6 +18,51 @@ use POSIX(); use Test2::Util qw/try get_tid pkg_to_file IS_WIN32/; use Test2::API qw/test2_ipc_set_pending/; +BEGIN { + if (IS_WIN32) { + my $max_tries = 5; + + *do_rename = sub { + my ($from, $to) = @_; + + my $err; + for (1 .. $max_tries) { + return (1) if rename($from, $to); + $err = "$!"; + last if $_ == $max_tries; + sleep 1; + } + + return (0, $err); + }; + *do_unlink = sub { + my ($file) = @_; + + my $err; + for (1 .. $max_tries) { + return (1) if unlink($file); + $err = "$!"; + last if $_ == $max_tries; + sleep 1; + } + + return (0, "$!"); + }; + } + else { + *do_rename = sub { + my ($from, $to) = @_; + return (1) if rename($from, $to); + return (0, "$!"); + }; + *do_unlink = sub { + my ($file) = @_; + return (1) if unlink($file); + return (0, "$!"); + }; + } +} + sub use_shm { 1 } sub shm_size() { 64 } @@ -107,10 +152,12 @@ sub drop_hub { unless get_tid() == $tid; if ($ENV{T2_KEEP_TEMPDIR}) { - rename($hfile, File::Spec->canonpath("$hfile.complete")) or $self->abort_trace("Could not rename file '$hfile' -> '$hfile.complete'"); + my ($ok, $err) = do_rename($hfile, File::Spec->canonpath("$hfile.complete")); + $self->abort_trace("Could not rename file '$hfile' -> '$hfile.complete': $err") unless $ok } else { - unlink($hfile) or $self->abort_trace("Could not remove file for hub '$hid'"); + my ($ok, $err) = do_unlink($hfile); + $self->abort_trace("Could not remove file for hub '$hid': $err") unless $ok } opendir(my $dh, $tdir) or $self->abort_trace("Could not open temp dir!"); @@ -170,7 +217,11 @@ do so if Test::Builder is loaded for legacy reasons. # Write and rename the file. my ($ok, $err) = try { Storable::store($e, $file); - rename($file, $ready) or $self->abort("Could not rename file '$file' -> '$ready'"); + my ($ok, $err) = do_rename("$file", $ready); + unless ($ok) { + POSIX::sigprocmask(POSIX::SIG_SETMASK(), $old, POSIX::SigSet->new()) if defined $blocked; + $self->abort("Could not rename file '$file' -> '$ready': $err"); + }; test2_ipc_set_pending(substr($file, -(shm_size))); }; @@ -214,35 +265,22 @@ sub cull { opendir(my $dh, $tempdir) or $self->abort("could not open IPC temp dir ($tempdir)!"); my @out; - for my $file (sort readdir($dh)) { - next if substr($file, 0, 1) eq '.'; - - next unless substr($file, -6, 6) eq '.ready'; - - my $global = substr($file, 0, 6) eq 'GLOBAL'; - my $hid_len = length($hid); - my $have_hid = !$global && substr($file, 0, $hid_len) eq $hid && substr($file, $hid_len, 1) eq '-'; - - next unless $have_hid || $global; - - next if $global && $self->{+GLOBALS}->{$hid}->{$file}++; - - # Untaint the path. - my $full = File::Spec->catfile($tempdir, $file); - ($full) = ($full =~ m/^(.*)$/gs); - + for my $info (sort cmp_events map { $self->should_read_event($hid, $_) } readdir($dh)) { + my $full = $info->{full_path}; my $obj = $self->read_event_file($full); push @out => $obj; # Do not remove global events - next if $global; + next if $info->{global}; - my $complete = File::Spec->canonpath("$full.complete"); if ($ENV{T2_KEEP_TEMPDIR}) { - rename($full, $complete) or $self->abort("Could not rename IPC file '$full', '$complete'"); + my $complete = File::Spec->canonpath("$full.complete"); + my ($ok, $err) = do_rename($full, $complete); + $self->abort("Could not rename IPC file '$full', '$complete': $err") unless $ok; } else { - unlink($full) or $self->abort("Could not unlink IPC file: $file"); + my ($ok, $err) = do_unlink("$full"); + $self->abort("Could not unlink IPC file '$full': $err") unless $ok; } } @@ -250,6 +288,64 @@ sub cull { return @out; } +sub parse_event_filename { + my $self = shift; + my ($file) = @_; + + # The || is to force 0 in false + my $complete = substr($file, -9, 9) eq '.complete' || 0 and substr($file, -9, 9, ""); + my $ready = substr($file, -6, 6) eq '.ready' || 0 and substr($file, -6, 6, ""); + + my @parts = split '-', $file; + my ($global, $hid) = $parts[0] eq 'GLOBAL' ? (1, shift @parts) : (0, join '-' => splice(@parts, 0, 3)); + my ($pid, $tid, $eid) = splice(@parts, 0, 3); + my $type = join '::' => @parts; + + return { + ready => $ready, + complete => $complete, + global => $global, + type => $type, + hid => $hid, + pid => $pid, + tid => $tid, + eid => $eid, + }; +} + +sub should_read_event { + my $self = shift; + my ($hid, $file) = @_; + + return if substr($file, 0, 1) eq '.'; + + my $parsed = $self->parse_event_filename($file); + + return if $parsed->{complete}; + return unless $parsed->{ready}; + return unless $parsed->{global} || $parsed->{hid} eq $hid; + + return if $parsed->{global} && $self->{+GLOBALS}->{$hid}->{$file}++; + + # Untaint the path. + my $full = File::Spec->catfile($self->{+TEMPDIR}, $file); + ($full) = ($full =~ m/^(.*)$/gs) if ${^TAINT}; + + $parsed->{full_path} = $full; + + return $parsed; +} + +sub cmp_events { + # Globals first + return -1 if $a->{global} && !$b->{global}; + return 1 if $b->{global} && !$a->{global}; + + return $a->{pid} <=> $b->{pid} + || $a->{tid} <=> $b->{tid} + || $a->{eid} <=> $b->{eid}; +} + sub read_event_file { my $self = shift; my ($file) = @_; @@ -306,7 +402,8 @@ sub DESTROY { $full =~ m/^(.*)$/; $full = $1; # Untaint it next if $ENV{T2_KEEP_TEMPDIR}; - unlink($full) or $self->abort("Could not unlink IPC file: $full"); + my ($ok, $err) = do_unlink($full); + $self->abort("Could not unlink IPC file '$full': $err") unless $ok; next; } diff --git a/cpan/Test-Simple/lib/Test2/Util.pm b/cpan/Test-Simple/lib/Test2/Util.pm index 299a0be336..c44a752422 100644 --- a/cpan/Test-Simple/lib/Test2/Util.pm +++ b/cpan/Test-Simple/lib/Test2/Util.pm @@ -2,7 +2,7 @@ package Test2::Util; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Config qw/%Config/; diff --git a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm index 37ce841710..e7555e3258 100644 --- a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm +++ b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm @@ -2,7 +2,7 @@ package Test2::Util::ExternalMeta; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm index a61b7fb43a..112138503d 100644 --- a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm +++ b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm @@ -2,7 +2,7 @@ package Test2::Util::HashBase; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; require Carp; diff --git a/cpan/Test-Simple/lib/Test2/Util/Trace.pm b/cpan/Test-Simple/lib/Test2/Util/Trace.pm index 67286f9f5a..0dc99fe6b1 100644 --- a/cpan/Test-Simple/lib/Test2/Util/Trace.pm +++ b/cpan/Test-Simple/lib/Test2/Util/Trace.pm @@ -2,7 +2,7 @@ package Test2::Util::Trace; use strict; use warnings; -our $VERSION = '1.302040'; +our $VERSION = '1.302045'; use Test2::Util qw/get_tid/; diff --git a/cpan/Test-Simple/lib/ok.pm b/cpan/Test-Simple/lib/ok.pm index c8cf3081ba..5f3dd1cdfa 100644 --- a/cpan/Test-Simple/lib/ok.pm +++ b/cpan/Test-Simple/lib/ok.pm @@ -1,5 +1,5 @@ package ok; -$ok::VERSION = '1.302040'; +$ok::VERSION = '1.302045'; use strict; use Test::More (); diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t index 5cda691aae..1691751f1c 100644 --- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t +++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t @@ -2,6 +2,7 @@ BEGIN { require "t/tools.pl" }; use Test2::Util qw/get_tid USE_THREADS try/; use File::Temp qw/tempfile/; use File::Spec qw/catfile/; +use List::Util qw/shuffle/; use strict; use warnings; @@ -40,7 +41,7 @@ ok(-d $ipc->tempdir, "created temp dir"); is($ipc->pid, $$, "stored pid"); is($ipc->tid, get_tid(), "stored the tid"); -my $hid = '12345'; +my $hid = '12345-1-1'; $ipc->add_hub($hid); my $hubfile = File::Spec->catfile($ipc->tempdir, "HUB-$hid"); @@ -171,8 +172,8 @@ ok(!-d $tmpdir, "cleaned up temp dir"); like($out->{STDERR}, qr/IPC Temp Dir: \Q$tmpdir\E/m, "Got temp dir path"); like($out->{STDERR}, qr/^# Not removing temp dir: \Q$tmpdir\E$/m, "Notice about not closing tempdir"); - like($out->{STDERR}, qr/^IPC Fatal Error: File for hub '12345' already exists/m, "Got message for duplicate hub"); - like($out->{STDERR}, qr/^IPC Fatal Error: File for hub '12345' does not exist/m, "Cannot remove hub twice"); + like($out->{STDERR}, qr/^IPC Fatal Error: File for hub '12345-1-1' already exists/m, "Got message for duplicate hub"); + like($out->{STDERR}, qr/^IPC Fatal Error: File for hub '12345-1-1' does not exist/m, "Cannot remove hub twice"); $out = capture { my $ipc = Test2::IPC::Driver::Files->new(); @@ -185,7 +186,7 @@ ok(!-d $tmpdir, "cleaned up temp dir"); like($out->{STDERR}, qr/IPC Fatal Error:/, "Got fatal error"); like($out->{STDERR}, qr/There was an error writing an event/, "Explanation"); - like($out->{STDERR}, qr/Destination: 12345/, "Got dest"); + like($out->{STDERR}, qr/Destination: 12345-1-1/, "Got dest"); like($out->{STDERR}, qr/Origin PID:\s+$$/, "Got pid"); like($out->{STDERR}, qr/Error: Can't store GLOB items/, "Got cause"); @@ -196,7 +197,7 @@ ok(!-d $tmpdir, "cleaned up temp dir"); print STDERR $@ unless $@ =~ m/^255/; $ipc = undef; }; - like($out->{STDERR}, qr/IPC Fatal Error: hub '12345' is not available, failed to send event!/, "Cannot send to missing hub"); + like($out->{STDERR}, qr/IPC Fatal Error: hub '12345-1-1' is not available, failed to send event!/, "Cannot send to missing hub"); $out = capture { my $ipc = Test2::IPC::Driver::Files->new(); @@ -208,7 +209,7 @@ ok(!-d $tmpdir, "cleaned up temp dir"); print STDERR $@ unless $@ =~ m/^255/; }; $cleanup->(); - like($out->{STDERR}, qr/IPC Fatal Error: Not all files from hub '12345' have been collected/, "Leftover files"); + like($out->{STDERR}, qr/IPC Fatal Error: Not all files from hub '12345-1-1' have been collected/, "Leftover files"); like($out->{STDERR}, qr/IPC Fatal Error: Leftover files in the directory \(.*\.ready\)/, "What file"); $out = capture { @@ -294,5 +295,232 @@ ok(!-d $tmpdir, "cleaned up temp dir"); $ipc = undef; } -done_testing; +{ + my @list = shuffle ( + {global => 0, pid => 2, tid => 1, eid => 1}, + {global => 0, pid => 2, tid => 1, eid => 2}, + {global => 0, pid => 2, tid => 1, eid => 3}, + + {global => 1, pid => 1, tid => 1, eid => 1}, + {global => 1, pid => 12, tid => 1, eid => 3}, + {global => 1, pid => 11, tid => 1, eid => 2}, + + {global => 0, pid => 2, tid => 3, eid => 1}, + {global => 0, pid => 2, tid => 3, eid => 10}, + {global => 0, pid => 2, tid => 3, eid => 100}, + + {global => 0, pid => 5, tid => 3, eid => 2}, + {global => 0, pid => 5, tid => 3, eid => 20}, + {global => 0, pid => 5, tid => 3, eid => 200}, + ); + + my @sorted; + { + package Test2::IPC::Driver::Files; + @sorted = sort cmp_events @list; + } + + is_deeply( + \@sorted, + [ + {global => 1, pid => 1, tid => 1, eid => 1}, + {global => 1, pid => 11, tid => 1, eid => 2}, + {global => 1, pid => 12, tid => 1, eid => 3}, + + {global => 0, pid => 2, tid => 1, eid => 1}, + {global => 0, pid => 2, tid => 1, eid => 2}, + {global => 0, pid => 2, tid => 1, eid => 3}, + + {global => 0, pid => 2, tid => 3, eid => 1}, + {global => 0, pid => 2, tid => 3, eid => 10}, + {global => 0, pid => 2, tid => 3, eid => 100}, + + {global => 0, pid => 5, tid => 3, eid => 2}, + {global => 0, pid => 5, tid => 3, eid => 20}, + {global => 0, pid => 5, tid => 3, eid => 200}, + ], + "Sort by global, pid, tid and then eid" + ); +} + +{ + my $ipc = 'Test2::IPC::Driver::Files'; + + is_deeply( + $ipc->parse_event_filename('GLOBAL-123-456-789-Event-Type-Foo.ready.complete'), + { + ready => 1, + complete => 1, + global => 1, + type => "Event::Type::Foo", + hid => "GLOBAL", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed global complete" + ); + + is_deeply( + $ipc->parse_event_filename('GLOBAL-123-456-789-Event-Type-Foo.ready'), + { + ready => 1, + complete => 0, + global => 1, + type => "Event::Type::Foo", + hid => "GLOBAL", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed global ready" + ); + + is_deeply( + $ipc->parse_event_filename('GLOBAL-123-456-789-Event-Type-Foo'), + { + ready => 0, + complete => 0, + global => 1, + type => "Event::Type::Foo", + hid => "GLOBAL", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed global not ready" + ); + + is_deeply( + $ipc->parse_event_filename('1-1-1-123-456-789-Event-Type-Foo.ready.complete'), + { + ready => 1, + complete => 1, + global => 0, + type => "Event::Type::Foo", + hid => "1-1-1", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed event complete" + ); + + is_deeply( + $ipc->parse_event_filename('1-2-3-123-456-789-Event-Type-Foo.ready'), + { + ready => 1, + complete => 0, + global => 0, + type => "Event::Type::Foo", + hid => "1-2-3", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed event ready" + ); + + is_deeply( + $ipc->parse_event_filename('3-2-11-123-456-789-Event'), + { + ready => 0, + complete => 0, + global => 0, + type => "Event", + hid => "3-2-11", + pid => "123", + tid => "456", + eid => "789", + }, + "Parsed event not ready" + ); +} + +{ + my $ipc = Test2::IPC::Driver::Files->new(); + + my $hid = "1-1-1"; + + is_deeply( + $ipc->should_read_event($hid, "GLOBAL-123-456-789-Event-Type-Foo.ready.complete") ? 1 : 0, + 0, + "Do not read complete global" + ); + is_deeply( + $ipc->should_read_event($hid, "GLOBAL-123-456-789-Event-Type-Foo.ready") ? 1 : 0, + 1, + "Should read ready global the first time" + ); + is_deeply( + $ipc->should_read_event($hid, "GLOBAL-123-456-789-Event-Type-Foo.ready") ? 1 : 0, + 0, + "Should not read ready global again" + ); + + is_deeply( + $ipc->should_read_event($hid, "GLOBAL-123-456-789-Event-Type-Foo") ? 1 : 0, + 0, + "Should not read un-ready global" + ); + + is_deeply( + $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo.ready.complete") ? 1 : 0, + 0, + "Do not read complete our hid" + ); + + is_deeply( + $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo.ready") ? 1 : 0, + 1, + "Should read ready our hid" + ); + + is_deeply( + $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo.ready") ? 1 : 0, + 1, + "Should read ready our hid (again, no duplicate checking)" + ); + + is_deeply( + $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo") ? 1 : 0, + 0, + "Should not read un-ready our hid" + ); + + is_deeply( + $ipc->should_read_event($hid, "1-2-3-123-456-789-Event-Type-Foo.ready.complete") ? 1 : 0, + 0, + "Not ours - complete" + ); + + is_deeply( + $ipc->should_read_event($hid, "1-2-3-123-456-789-Event-Type-Foo.ready") ? 1 : 0, + 0, + "Not ours - ready" + ); + + is_deeply( + $ipc->should_read_event($hid, "1-2-3-123-456-789-Event-Type-Foo") ? 1 : 0, + 0, + "Not ours - unready" + ); + + my @got = $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo"); + ok(!@got, "return empty list for false"); + + @got = $ipc->should_read_event($hid, "$hid-123-456-789-Event-Type-Foo.ready"); + is(@got, 1, "got 1 item on true"); + + like(delete $got[0]->{full_path}, qr{^.+\Q$hid\E-123-456-789-Event-Type-Foo\.ready$}, "Got full path"); + is_deeply( + $got[0], + $ipc->parse_event_filename("$hid-123-456-789-Event-Type-Foo.ready"), + "Apart from full_path we get entire parsed filename" + ); + + $ipc = undef; +} + +done_testing; diff --git a/cpan/Test-Simple/t/Test2/regression/693_ipc_ordering.t b/cpan/Test-Simple/t/Test2/regression/693_ipc_ordering.t new file mode 100644 index 0000000000..c365b8a777 --- /dev/null +++ b/cpan/Test-Simple/t/Test2/regression/693_ipc_ordering.t @@ -0,0 +1,30 @@ +BEGIN { require "t/tools.pl" }; +use strict; +use warnings; + +skip_all("Test cannot run on perls below 5.8.8") unless "$]" > 5.008007; + +use Test2::Util qw/CAN_THREAD/; +use Test2::IPC; +use Test2::API qw/context intercept/; + +skip_all('System does not have threads') unless CAN_THREAD(); + +require threads; +threads->import; + +my $events = intercept { + threads->create( + sub { + ok 1, "something $_ nonlocal" for (1 .. 15); + } + )->join; +}; + +is_deeply( + [map { $_->{name} } @$events], + [map "something $_ nonlocal", 1 .. 15], + "Culled sub-thread events in correct order" +); + +done_testing; |