X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=blobdiff_plain;f=t%2F54-unwind-threads.t;h=490e6ad56137d6f5ba69e1b82884316ccb17989f;hp=56457670f74be22c6864d1814ab6346c36688ed9;hb=57746d0b3de44a1205902e433488c8a1afe69469;hpb=6f291620e2f901595a01b388f891d93bd9de88e8 diff --git a/t/54-unwind-threads.t b/t/54-unwind-threads.t index 5645767..490e6ad 100644 --- a/t/54-unwind-threads.t +++ b/t/54-unwind-threads.t @@ -1,10 +1,13 @@ -#!perl -T +#!perl use strict; use warnings; use lib 't/lib'; -use Scope::Upper::TestThreads; +use VPIT::TestHelpers ( + threads => [ 'Scope::Upper' => 'Scope::Upper::SU_THREADSAFE()' ], + 'usleep', +); use Test::Leaner; @@ -17,7 +20,7 @@ sub up1 { local $z = $tid; my $p = "[$tid] up1"; - usleep rand(1e6); + usleep rand(2.5e5); my @res = ( -1, @@ -35,12 +38,17 @@ sub up1 { ); is_deeply \@res, [ -1, $tid .. $tid + 2, -2 ], "$p: unwinded correctly"; + + return 1; } my @threads = map spawn(\&up1), 1 .. 30; -$_->join for @threads; +my $completed = 0; +for my $thr (@threads) { + ++$completed if $thr->join; +} pass 'done'; -done_testing(scalar(@threads) + 1); +done_testing($completed + 1);