From: Vincent Pit Date: Thu, 30 Dec 2010 22:58:04 +0000 (+0100) Subject: Make it easier to tweak the parameters of t/50-threads.t X-Git-Tag: v0.07~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fautovivification.git;a=commitdiff_plain;h=f424a623070821112b8dd42506aa772ad19f22bb Make it easier to tweak the parameters of t/50-threads.t --- diff --git a/t/50-threads.t b/t/50-threads.t index 258bf08..925b8bb 100644 --- a/t/50-threads.t +++ b/t/50-threads.t @@ -27,7 +27,16 @@ BEGIN { require autovivification; skipall 'This autovivification isn\'t thread safe' unless autovivification::A_THREADSAFE(); - plan tests => 10 * 2 * 3 * (1 + 2); +} + +my ($threads, $runs); +BEGIN { + $threads = 10; + $runs = 2; +} + +BEGIN { + plan tests => $threads * $runs * 3 * (1 + 2); defined and diag "Using threads $_" for $threads::VERSION; } @@ -37,7 +46,7 @@ BEGIN { sub try { my $tid = threads->tid(); - for my $run (1 .. 2) { + for my $run (1 .. $runs) { { my $x; my $y = $x->{foo}; @@ -81,5 +90,5 @@ SKIP: } } -my @t = map threads->create(\&try), 1 .. 10; +my @t = map threads->create(\&try), 1 .. $threads; $_->join for @t;