Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions lib/Test/Class/Moose/Executor/Parallel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ sub _test_class_is_parallelizable {
$_,
'noparallel'
);
}
$self->_test_methods_for($test_class);
}

$self->_test_methods_for($test_class);
}

sub _run_test_classes_in_parallel {
Expand All @@ -116,15 +117,28 @@ sub _run_test_classes_in_parallel {
}

# This chunk of code only runs in child processes
my $child_pid = $$;

my $class_report;
$subtest->attach($id);
$subtest->run(
sub {
$class_report = $self->run_test_class($test_class);
}
);
$subtest->detach;
$self->_fork_manager->finish( 0, \$class_report );

# if the test class also creates forks, and one of those forks dies,
# the dead child ends up running here, and causes subsequent problems
# with Test2::AsyncSubtest::detach, and can potentially cascade into
# all kinds of other problems during global destruction. i have no
# idea how a grandchild death can end up running this code...
if ( $$ == $child_pid ) {
$subtest->detach;
$self->_fork_manager->finish( 0, \$class_report );
}
else {
warn "Ignoring unknown child pid $$, did a grandchild pid die?";
}
}

$self->_fork_manager->wait_all_children;
Expand Down