| 1 | package Test2::AsyncSubtest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 69 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 69 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 69 | ▶ | use Test2::IPC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 69 | our $VERSION = '1.302226'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 69 | our @CARP_NOT = qw/Test2::Util::HashBase/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 69 | ▶ | use Carp qw/croak cluck confess/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 69 | ▶ | use Test2::Util qw/get_tid CAN_THREAD CAN_FORK/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 69 | ▶ | use Scalar::Util qw/blessed weaken/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 69 | ▶ | use List::Util qw/first/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 69 | ▶ | use Test2::API(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 69 | ▶ | use Test2::API::Context(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 69 | ▶ | use Test2::Util::Trace(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 69 | ▶ | use Test2::Util::Guard(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 69 | ▶ | use Time::HiRes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 69 | ▶ | use Test2::AsyncSubtest::Hub(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 69 | ▶ | use Test2::AsyncSubtest::Event::Attach(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 69 | ▶ | use Test2::AsyncSubtest::Event::Detach(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 69 | ▶ | use Test2::Util::HashBase qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | name hub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | trace frame send_to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | events | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | finished | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | active | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | stack | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | id cid uuid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | children | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | _in_use | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | _attached pid tid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | start_stamp stop_stamp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 69 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 44 | ▶ | sub CAN_REALLY_THREAD { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CAN_REALLY_THREAD: called CC=2 SCAR=15.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 44 | return 0 unless CAN_THREAD; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | return 0 unless eval { require threads; threads->VERSION('1.34'); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 69 | my $UUID_VIA = Test2::API::_add_uuid_via_ref(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 69 | my $CID = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 69 | my @STACK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub TOP { @STACK ? $STACK[-1] : undef } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TOP: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 510 | ▶ | sub init { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=10 SCAR=23.3
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 510 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | croak "'name' is a required attribute" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 510 | ▶ | unless $self->{+NAME}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 509 | ▶ | my $to = $self->{+SEND_TO} ||= Test2::API::test2_stack()->top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"send_to"} ||= Test2::API::test2_stack()->top
MC/DC0%0/2
$self->{"send_to"} ||= Test2::API::test2_stack()->top
$self->{"send_to"}
Test2::API::test2_stack()->top
Truth table33%1/3
A ||= B
A= $self->{"send_to"}B= Test2::API::test2_stack()->top
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 509 | $self->{+STACK} = [@STACK]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 509 | $_->{+_IN_USE}++ for reverse @STACK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 509 | $self->{+TID} = get_tid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 509 | $self->{+PID} = $$; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 509 | $self->{+CID} = 'AsyncSubtest-' . $CID++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 509 | $self->{+ID} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 509 | $self->{+FINISHED} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 509 | $self->{+ACTIVE} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 509 | $self->{+_IN_USE} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 509 | $self->{+CHILDREN} = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 509 | ▶ | $self->{+UUID} = ${$UUID_VIA}->() if defined $$UUID_VIA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 509 | ▶ | unless($self->{+HUB}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 509 | my $ipc = Test2::API::test2_ipc(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 509 | my $formatter = Test2::API::test2_stack->top->format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 509 | ▶ | my $args = delete $self->{hub_init_args} || {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $self->{'hub_init_args'} || {}
MC/DC100%1/1
delete $self->{'hub_init_args'} || {}
delete $self->{'hub_init_args'}
Truth table100%2/2
A
A= delete $self->{'hub_init_args'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 509 | my $hub = Test2::AsyncSubtest::Hub->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | %$args, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ipc => $ipc, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | nested => $to->nested + 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | buffered => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | formatter => $formatter, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 509 | weaken($hub->{ast} = $self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 509 | $self->{+HUB} = $hub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | $self->{+TRACE} ||= Test2::Util::Trace->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | frame => $self->{+FRAME} || [caller(1)], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | buffered => $to->buffered, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | nested => $to->nested, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | cid => $self->{+CID}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 509 | ▶ | uuid => $self->{+UUID}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$self->{"trace"} ||= "Test2::Util::Trace"->new("frame", $self->{"frame"} || [caller 1], "buffered", $to->buffered, "nested", $to->nested, "cid", $self->{"cid"}, "uuid", $self->{"uuid"}, "hid", $to->hid, "huuid", $to->uuid)
$self->{'frame'} || [caller 1]
MC/DC0%0/2
$self->{"trace"} ||= "Test2::Util::Trace"->new("frame", $self->{"frame"} || [caller 1], "buffered", $to->buffered, "nested", $to->nested, "cid", $self->{"cid"}, "uuid", $self->{"uuid"}, "hid", $to->hid, "huuid", $to->uuid)
$self->{"trace"}
"Test2::Util::Trace"->new("frame", $self->{"frame"} || [caller 1], "buffered", $to->buffered, "nested", $to->nested, "cid", $self->{"cid"}, "uuid", $self->{"uuid"}, "hid", $to->hid, "huuid", $to->uuid)
MC/DC100%1/1
$self->{'frame'} || [caller 1]
$self->{'frame'}
Truth table33%1/3
A ||= B
A= $self->{"trace"}B= "Test2::Util::Trace"->new("frame", $self->{"frame"} || [caller 1], "buffered", $to->buffered, "nested", $to->nested, "cid", $self->{"cid"}, "uuid", $self->{"uuid"}, "hid", $to->hid, "huuid", $to->uuid)
Truth table100%2/2
A
A= $self->{'frame'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | hid => $to->hid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | huuid => $to->uuid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 509 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 509 | ▶ | $hub->set_ast_ids({}) unless $hub->ast_ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 509 | $hub->listen($self->_listener); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 509 | ▶ | sub _listener { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_listener: called CC=2 SCAR=7.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 509 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 509 | ▶ | my $events = $self->{+EVENTS} ||= []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"events"} ||= []
MC/DC0%0/1
$self->{"events"} ||= []
$self->{"events"}
Truth table50%1/2
A
A= $self->{"events"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 509 | ▶ | sub { push @$events => $_[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 404 | ▶ | sub context { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
context: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 404 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 404 | my $send_to = $self->{+SEND_TO}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 404 | ▶ | confess "Attempt to close AsyncSubtest when original parent hub (a non async-subtest?) has ended" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | if $send_to->ended; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | return Test2::API::Context->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 403 | trace => $self->{+TRACE}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | hub => $send_to, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 96 | ▶ | sub _gen_event { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gen_event: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 96 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 96 | my ($type, $id, $hub) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 96 | my $class = "Test2::AsyncSubtest::Event::$type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | return $class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | id => $id, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | trace => Test2::Util::Trace->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | frame => [caller(1)], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | buffered => $hub->buffered, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | nested => $hub->nested, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | cid => $self->{+CID}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 96 | uuid => $self->{+UUID}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | hid => $hub->hid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | huuid => $hub->uuid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 298 | ▶ | sub cleave { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleave: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 298 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 298 | my $id = $self->{+ID}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 298 | $self->{+HUB}->ast_ids->{$id} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 298 | return $id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 50 | ▶ | sub attach { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach: called CC=5 SCAR=16.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 50 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 50 | my ($id) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 50 | ▶ | croak "An ID is required" unless $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | croak "ID $id is not valid" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 50 | ▶ | unless defined $self->{+HUB}->ast_ids->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | croak "ID $id is already attached" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 50 | ▶ | if $self->{+HUB}->ast_ids->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | croak "You must attach INSIDE the child process/thread" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 50 | ▶ | if $self->{+HUB}->is_local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 50 | $self->{+_ATTACHED} = [ $$, get_tid, $id ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 50 | $self->{+HUB}->send($self->_gen_event('Attach', $id, $self->{+HUB})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 46 | ▶ | sub detach { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detach: called CC=6 SCAR=21.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 46 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 46 | ▶ | if ($self->{+PID} == $$ && $self->{+TID} == get_tid) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"pid"} == $$ and $self->{"tid"} == 0
MC/DC0%0/2
$self->{"pid"} == $$ and $self->{"tid"} == 0
$self->{"pid"} == $$
$self->{"tid"} == 0
Truth table33%1/3
A and B
A= $self->{"pid"} == $$B= $self->{"tid"} == 0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | cluck "You must detach INSIDE the child process/thread ($$, " . get_tid . " instead of $self->{+PID}, $self->{+TID})"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 46 | ▶ | my $att = $self->{+_ATTACHED} | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | or croak "Not attached"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 46 | ▶ | croak "Attempt to detach from wrong child" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$att->[0] == $$ and $att->[1] == 0
MC/DC0%0/2
$att->[0] == $$ and $att->[1] == 0
$att->[0] == $$
$att->[1] == 0
Truth table33%1/3
A and B
A= $att->[0] == $$B= $att->[1] == 0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | unless $att->[0] == $$ && $att->[1] == get_tid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 46 | my $id = $att->[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 46 | $self->{+HUB}->send($self->_gen_event('Detach', $id, $self->{+HUB})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 46 | delete $self->{+_ATTACHED}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1327 | ▶ | sub ready { return !shift->pending } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ready: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1329 | ▶ | sub pending { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pending: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1329 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1329 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 1329 | ▶ | return -1 unless $hub->is_local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1244 | $hub->cull; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1244 | return $self->{+_IN_USE} + keys %{$self->{+HUB}->ast_ids}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 60 | ▶ | sub run { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=9 SCAR=23.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 60 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 60 | my ($code, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 60 | ▶ | croak "AsyncSubtest->run() takes a codeblock as the first argument" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$code and ref $code eq "CODE"
MC/DC0%0/2
$code and ref $code eq "CODE"
$code
ref $code eq "CODE"
Truth table33%1/3
A and B
A= $codeB= ref $code eq "CODE"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | unless $code && ref($code) eq 'CODE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 60 | $self->start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 60 | my ($ok, $err, $finished); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | T2_SUBTEST_WRAPPER: { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 60 | $ok = eval { $code->(@args); 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 41 | $err = $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # They might have done 'BEGIN { skip_all => "whatever" }' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 41 | ▶ | if (!$ok && $err =~ m/Label not found for "last T2_SUBTEST_WRAPPER"/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/
MC/DC0%0/2
not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/
not $ok
$err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/
Truth table66%2/3
not(A) and B
A= not $okB= $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $ok = undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $err = undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 41 | $finished = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 57 | $self->stop; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 57 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 57 | ▶ | if (!$finished) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 16 | ▶ | if(my $bailed = $hub->bailed_out) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $ctx = $self->context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $ctx->bail($bailed->reason); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 16 | my $code = $hub->exit_code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 16 | $ok = !$code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 16 | ▶ | $err = "Subtest ended with exit code $code" if $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 57 | ▶ | unless ($ok) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | my $e = Test2::Event::Exception->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | error => $err, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | trace => Test2::Util::Trace->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | frame => [caller(0)], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | buffered => $hub->buffered, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | nested => $hub->nested, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | cid => $self->{+CID}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 1 | uuid => $self->{+UUID}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | hid => $hub->hid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | huuid => $hub->uuid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | $hub->send($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 57 | return $hub->is_passing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 252 | ▶ | sub start { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=3 SCAR=11.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 252 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | croak "Subtest is already complete" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 252 | ▶ | if $self->{+FINISHED}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 252 | ▶ | $self->{+START_STAMP} = Time::HiRes::time() unless defined $self->{+START_STAMP}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 252 | $self->{+ACTIVE}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 252 | push @STACK => $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 252 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 252 | my $stack = Test2::API::test2_stack(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 252 | $stack->push($hub); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 252 | return $hub->is_passing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 236 | ▶ | sub stop { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stop: called CC=4 SCAR=14.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 236 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | croak "Subtest is not active" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 236 | ▶ | unless $self->{+ACTIVE}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 236 | ▶ | croak "AsyncSubtest stack mismatch" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@STACK and $self == $STACK[-1]
MC/DC0%0/2
@STACK and $self == $STACK[-1]
@STACK
$self == $STACK[-1]
Truth table33%1/3
A and B
A= @STACKB= $self == $STACK[-1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | unless @STACK && $self == $STACK[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 236 | $self->{+STOP_STAMP} = Time::HiRes::time(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 236 | pop @STACK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 236 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 236 | my $stack = Test2::API::test2_stack(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 236 | $stack->pop($hub); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 236 | return $hub->is_passing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 404 | ▶ | sub finish { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish: called CC=23 SCAR=32.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 404 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 404 | my %params = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 404 | my $hub = $self->hub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | croak "Subtest is already finished" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 404 | ▶ | if $self->{+FINISHED}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 404 | ▶ | croak "Subtest can only be finished in the process/thread that created it" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | unless $hub->is_local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | croak "Subtest is still active" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 404 | ▶ | if $self->{+ACTIVE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 404 | $self->wait; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 404 | ▶ | $self->{+STOP_STAMP} = Time::HiRes::time() unless defined $self->{+STOP_STAMP}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 404 | my $stop_stamp = $self->{+STOP_STAMP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 404 | my $todo = $params{todo}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 404 | my $skip = $params{skip}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 404 | my $empty = !@{$self->{+EVENTS}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 404 | my $no_asserts = !$hub->count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 404 | my $collapse = $params{collapse}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 404 | ▶ | my $no_plan = $params{no_plan} || ($collapse && $no_asserts) || $skip; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
$params{'no_plan'} || $collapse && $no_asserts || $skip
$params{"no_plan"} or $collapse and $no_asserts
$collapse and $no_asserts
MC/DC75%3/4
$params{'no_plan'} || $collapse && $no_asserts || $skip
$params{"no_plan"}
$collapse
$no_asserts
$skip
Truth table66%4/6
A or B and C || D
A= $params{"no_plan"}B= $collapseC= $no_assertsD= $skip
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | my $trace = Test2::Util::Trace->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | frame => $self->{+TRACE}->{frame}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | buffered => $hub->buffered, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | nested => $hub->nested, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | cid => $self->{+CID}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 404 | uuid => $self->{+UUID}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | hid => $hub->hid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | huuid => $hub->uuid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 404 | ▶ | $hub->finalize($trace, !$no_plan) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hub->no_ending or $hub->ended
MC/DC0%0/2
$hub->no_ending or $hub->ended
$hub->no_ending
$hub->ended
Truth table33%1/3
A or B
A= $hub->no_endingB= $hub->ended
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | unless $hub->no_ending || $hub->ended; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 404 | ▶ | if ($hub->ipc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 404 | $hub->ipc->drop_hub($hub->hid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 404 | $hub->set_ipc(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 404 | ▶ | return $hub->is_passing if $params{silent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 404 | my $ctx = $self->context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 403 | my $pass = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 403 | ▶ | if ($skip) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 15 | $ctx->skip($self->{+NAME}, $skip); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 388 | ▶ | if ($collapse && $empty) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$collapse and $empty
MC/DC100%2/2
$collapse and $empty
$collapse
$empty
Truth table100%3/3
A and B
A= $collapseB= $empty
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 3 | $ctx->ok($hub->is_passing, $self->{+NAME}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 3 | return $hub->is_passing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 385 | ▶ | if ($collapse && $no_asserts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$collapse and $no_asserts
MC/DC100%2/2
$collapse and $no_asserts
$collapse
$no_asserts
Truth table100%3/3
A and B
A= $collapseB= $no_asserts
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 2 | push @{$self->{+EVENTS}} => Test2::Event::Plan->new(trace => $trace, max => 0, directive => 'SKIP', reason => "No assertions"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | my $e = $ctx->build_event( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 'Subtest', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | pass => $hub->is_passing, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | subtest_id => $hub->id, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | subtest_uuid => $hub->uuid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | name => $self->{+NAME}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | buffered => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | subevents => $self->{+EVENTS}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | start_stamp => $self->{+START_STAMP}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 385 | ▶ | stop_stamp => $self->{+STOP_STAMP}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | $todo ? ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | todo => $todo, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | effective_pass => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ) : (), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 385 | $ctx->hub->send($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 385 | ▶ | unless ($e->effective_pass) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 5 | $ctx->failure_diag($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $ctx->diag("Bad subtest plan, expected " . $hub->plan . " but ran " . $hub->count) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if $hub->plan && !$hub->check_plan && !grep {$_->causes_fail} @{$self->{+EVENTS}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$hub->plan and not $hub->check_plan and not grep({$_->causes_fail;} @{$$self{"events"};})
$hub->plan and not $hub->check_plan
MC/DC0%0/3
$hub->plan and not $hub->check_plan and not grep({$_->causes_fail;} @{$$self{"events"};})
$hub->plan
not $hub->check_plan
not grep({$_->causes_fail;} @{$$self{"events"};})
Truth table50%2/4
A and not(B) and not(C)
A= $hub->planB= not $hub->check_planC= not grep({$_->causes_fail;} @{$$self{"events"};})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 385 | $pass = $e->pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 400 | $_->{+_IN_USE}-- for reverse @{$self->{+STACK}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 400 | return $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 404 | ▶ | sub wait { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wait: called CC=6 SCAR=19.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 404 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 404 | my $hub = $self->{+HUB}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 404 | my $children = $self->{+CHILDREN}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 404 | ▶ | while (@$children) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 210 | $hub->cull; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 210 | ▶ | if (my $child = pop @$children) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 210 | ▶ | if (blessed($child)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $child->join; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 210 | waitpid($child, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | Time::HiRes::sleep('0.01'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 404 | $hub->cull; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | cluck "Subtest '$self->{+NAME}': All children have completed, but we still appear to be pending" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 404 | ▶ | if $hub->is_local && keys %{$self->{+HUB}->ast_ids}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hub->is_local and keys %{$self->{"hub"}->ast_ids;}
MC/DC0%0/2
$hub->is_local and keys %{$self->{"hub"}->ast_ids;}
$hub->is_local
keys %{$self->{"hub"}->ast_ids;}
Truth table33%1/3
A and B
A= $hub->is_localB= keys %{$self->{"hub"}->ast_ids;}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 293 | ▶ | sub fork { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fork: called CC=4 SCAR=14.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 293 | ▶ | croak "Forking is not supported" unless CAN_FORK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 293 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 293 | my $id = $self->cleave; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 293 | my $pid = CORE::fork(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 293 | ▶ | unless (defined $pid) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | delete $self->{+HUB}->ast_ids->{$id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | croak "Failed to fork"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 293 | ▶ | if($pid) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 245 | push @{$self->{+CHILDREN}} => $pid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 245 | return $pid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 48 | $self->attach($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 48 | return $self->_guard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 182 | ▶ | sub run_fork { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_fork: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 182 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 182 | my ($code, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 182 | my $f = $self->fork; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 182 | ▶ | return $f unless blessed($f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 23 | $self->run($code, @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 22 | $self->detach(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 22 | $f->dismiss(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 22 | exit 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | sub run_thread { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_thread: not called CC=2 SCAR=17.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | croak "Threading is not supported" | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | unless CAN_REALLY_THREAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my ($code, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $id = $self->cleave; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | my $thr = threads->create(sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $self->attach($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $self->run($code, @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | $self->detach(get_tid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | push @{$self->{+CHILDREN}} => $thr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return $thr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 48 | ▶ | sub _guard { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_guard: called CC=1 SCAR=2.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 48 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 48 | my ($pid, $tid) = ($$, get_tid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | ▶ | return Test2::Util::Guard->new(sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=25.6
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | ▶ | return unless $$ == $pid && get_tid == $tid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$ == $pid and 0 == $tid
MC/DC0%0/2
$$ == $pid and 0 == $tid
$$ == $pid
0 == $tid
Truth table33%1/3
A and B
A= $$ == $pidB= 0 == $tid
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my $error = "Scope Leak"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | if (my $ex = $@) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | chomp($ex); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $error .= " ($ex)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | cluck $error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my $e = $self->context->build_event( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 'Exception', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | error => "$error\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $self->{+HUB}->send($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->detach(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | exit 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 48 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 431 | ▶ | sub DESTROY { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=8 SCAR=30.6
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 431 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 431 | ▶ | return unless $self->{+NAME}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 430 | ▶ | if (my $att = $self->{+_ATTACHED}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | return unless $self->{+HUB}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | eval { $self->detach() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 430 | ▶ | return if $self->{+FINISHED}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 44 | ▶ | return unless $self->{+PID} == $$; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | return unless $self->{+TID} == get_tid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | eval { $_->{+_IN_USE}-- for reverse @{$self->{+STACK}} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | warn "Subtest $self->{+NAME} did not finish!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | exit 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 69 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||