X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F51threadnodb.t;fp=t%2F51threadnodb.t;h=dd1a5018487284f53aa0bb8dce4fb10abc49b1c0;hb=85b487e71f2e279639f422833b7fab4d93a64cfd;hp=95c9aafa255933d88824bac63366e56bb85652a1;hpb=97fc8d212a84e6e8c04c11f6aea656e6170134c6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/51threadnodb.t b/t/51threadnodb.t index 95c9aaf..dd1a501 100644 --- a/t/51threadnodb.t +++ b/t/51threadnodb.t @@ -15,6 +15,7 @@ use threads; use strict; use warnings; use Test::More; +use DBIx::Class::_Util 'sigwarn_silencer'; use lib qw(t/lib); use DBICTest; @@ -36,14 +37,27 @@ my $schema = DBICTest->init_schema(no_deploy => 1); isa_ok ($schema, 'DBICTest::Schema'); my @threads; -push @threads, threads->create(sub { - my $rsrc = $schema->source('Artist'); - undef $schema; - isa_ok ($rsrc->schema, 'DBICTest::Schema'); - my $s2 = $rsrc->schema->clone; - - sleep 1; # without this many tasty crashes -}) for (1.. $num_children); +SKIP: { + + local $SIG{__WARN__} = sigwarn_silencer( qr/Thread creation failed/i ); + + for (1.. $num_children) { + push @threads, threads->create(sub { + my $rsrc = $schema->source('Artist'); + undef $schema; + isa_ok ($rsrc->schema, 'DBICTest::Schema'); + my $s2 = $rsrc->schema->clone; + + sleep 1; # without this many tasty crashes + }) || do { + skip "EAGAIN encountered, your system is likely bogged down: skipping rest of test", 1 + if $! == Errno::EAGAIN(); + + die "Unable to start thread: $!"; + }; + } +} + ok(1, "past spawning"); $_->join for @threads;