X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FSchema.pm;h=a4a6d5e0c6e8d9434f966344e185ad825b7e474b;hb=9b871b00c;hp=be36371673c1dca2bfe53567159b609922e72603;hpb=8d6b1478d8fa6f7c76e313ee72a72d5eb4c24d03;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest/Schema.pm b/t/lib/DBICTest/Schema.pm index be36371..a4a6d5e 100644 --- a/t/lib/DBICTest/Schema.pm +++ b/t/lib/DBICTest/Schema.pm @@ -9,8 +9,7 @@ use base 'DBIx::Class::Schema'; use Fcntl qw/:DEFAULT :seek :flock/; use Time::HiRes 'sleep'; -use Path::Class::File; -use File::Spec; +use DBICTest::RunMode; use DBICTest::Util qw/populate_weakregistry assert_empty_weakregistry local_umask/; use namespace::clean; @@ -150,9 +149,13 @@ sub connection { # Also if there is no connection - there is no lock to be had if ($locktype and (!$locker or $locker->{type} ne $locktype)) { - warn "$$ $0 $locktype" if $locktype eq 'generic' or $locktype eq 'SQLite'; + warn "$$ $0 $locktype" if ( + ($locktype eq 'generic' or $locktype eq 'SQLite') + and + DBICTest::RunMode->is_author + ); - my $lockpath = File::Spec->tmpdir . "/.dbictest_$locktype.lock"; + my $lockpath = DBICTest::RunMode->tmpdir->file(".dbictest_$locktype.lock"); my $lock_fh; { @@ -165,7 +168,12 @@ sub connection { # see if anyone was holding a lock before us, and wait up to 5 seconds for them to terminate # if we do not do this we may end up trampling over some long-running END or somesuch seek ($lock_fh, 0, SEEK_SET) or die "seek failed $!"; - if (read ($lock_fh, my $old_pid, 100) ) { + my $old_pid; + if ( + read ($lock_fh, $old_pid, 100) + and + ($old_pid) = $old_pid =~ /^(\d+)$/ + ) { for (1..50) { kill (0, $old_pid) or last; sleep 0.1;