run_harness_tests() {
local -x HARNESS_OPTIONS=c:j$VCPU_USE
+ if [[ "$VCPU_USE" == 1 ]]; then
+ ulim=$(( ( $(ps xH | wc -l) - 3 ) + 4 )) # (real count excluding header + ps + wc) + space for ( make + tee + harness + <actual test> )
+ echo_err "$(tstamp) Setting process/thread limit to $ulim"
+ ulimit -u $ulim
+ sleep 10 # needed to settle things down a bit
+ fi
make test 2> >(tee "$TEST_STDERR_LOG")
}
use strict;
use warnings;
use Test::More;
+use DBIx::Class::_Util 'sigwarn_silencer';
use lib qw(t/lib);
use DBICTest;
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;
is ($schema->storage->transaction_depth, 0, 'Start outside txn');
my @pids;
+ SKIP:
for my $action (
sub {
my $s = shift;
},
) {
my $pid = fork();
- die "Unable to fork: $!\n"
- if ! defined $pid;
+
+ if( ! defined $pid ) {
+ skip "EAGAIN encountered, your system is likely bogged down: skipping forking test", 1
+ if $! == Errno::EAGAIN();
+
+ die "Unable to fork: $!"
+ }
if ($pid) {
push @pids, $pid;
if $^O eq 'MSWin32';
my $pid = fork();
- die "Unable to fork: $!\n"
- if ! defined $pid;
+ if( ! defined $pid ) {
+
+ skip "EAGAIN encountered, your system is likely bogged down: skipping forking test", 1
+ if $! == Errno::EAGAIN();
+
+ die "Unable to fork: $!"
+ }
if ($pid) {
push @pids, $pid;