X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fzzzzzzz_sqlite_deadlock.t;h=b0e8f3b98907bde308dbe4b464447fec41f0ed3a;hb=bedbc8111dbbb98f89a36c3cf4e2f6903a4b01be;hp=b125d3971cae0191a1ffa86f12f7adb191cd715b;hpb=18b527f875fde58402584e5c36e9416e84bbb26e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/zzzzzzz_sqlite_deadlock.t b/t/zzzzzzz_sqlite_deadlock.t index b125d39..b0e8f3b 100644 --- a/t/zzzzzzz_sqlite_deadlock.t +++ b/t/zzzzzzz_sqlite_deadlock.t @@ -2,22 +2,34 @@ use strict; use warnings; use Test::More; -use Test::Exception; + use lib 't/lib'; +BEGIN { + require DBICTest::RunMode; + plan( skip_all => "Skipping test on plain module install" ) + if DBICTest::RunMode->is_plain; +} -use File::Temp (); +use Test::Exception; use DBICTest; -use DBICTest::Schema; +use File::Temp (); plan tests => 2; -my $wait_for = 10; # how many seconds to wait +my $wait_for = 120; # how many seconds to wait -# Fails on mac os *only*. Do not enable -$TODO = "This seems to be a DBD::SQLite problem, don't test for now"; +# don't lock anything - this is a tempfile anyway +$ENV{DBICTEST_LOCK_HOLDER} = -1; for my $close (0,1) { - my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' ); + my $tmp = File::Temp->new( + UNLINK => 1, + DIR => 't/var', + SUFFIX => '.db', + TEMPLATE => 'DBIxClass-XXXXXX', + EXLOCK => 0, # important for BSD and derivatives + ); + my $tmp_fn = $tmp->filename; close $tmp if $close; @@ -30,6 +42,7 @@ for my $close (0,1) { lives_ok (sub { my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); + $schema->storage->dbh_do(sub { $_[1]->do('PRAGMA synchronous = OFF') }); DBICTest->deploy_schema ($schema); DBICTest->populate_schema ($schema); });