X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F50fork.t;h=df6957cc9a605319d309e4473ef2846074f12af2;hb=720448921cee676e52ed7e7b37c17352ea9b8470;hp=d42c0f428a43bde33fbac303b739dc0d03aa934b;hpb=1346e22d4899edf837c77312259c3ebaaf71f602;p=dbsrgits%2FDBIx-Class.git diff --git a/t/50fork.t b/t/50fork.t index d42c0f4..df6957c 100644 --- a/t/50fork.t +++ b/t/50fork.t @@ -18,7 +18,7 @@ if($num_children !~ /^[0-9]+$/ || $num_children < 10) { $num_children = 10; } -plan tests => $num_children + 5; +plan tests => $num_children + 6; use lib qw(t/lib); @@ -34,7 +34,7 @@ eval { { local $SIG{__WARN__} = sub {}; eval { $dbh->do("DROP TABLE cd") }; - $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(255) NOT NULL UNIQUE, year VARCHAR(255));"); + $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER, single_track INTEGER);"); } $schema->resultset('CD')->create({ title => 'vacation in antarctica', artist => 123, year => 1901 }); @@ -45,6 +45,23 @@ eval { }; ok(!$@) or diag "Creation eval failed: $@"; +{ + my $pid = fork; + if(!defined $pid) { + die "fork failed: $!"; + } + + if (!$pid) { + exit $schema->storage->connected ? 1 : 0; + } + + if (waitpid($pid, 0) == $pid) { + my $ex = $? >> 8; + ok($ex == 0, "storage->connected() returns false in child"); + exit $ex if $ex; # skip remaining tests + } +} + my @pids; while(@pids < $num_children) {