From: Peter Rabbitson Date: Thu, 25 Jun 2009 07:19:10 +0000 (+0000) Subject: Commit test inspired by joel - it seemingly fails on Mac? X-Git-Tag: v0.08108~61 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d7b94f7a8b58ac139576fae2d2ea5bd9bcd9c00e;p=dbsrgits%2FDBIx-Class.git Commit test inspired by joel - it seemingly fails on Mac? --- diff --git a/t/zzzzzzz_sqlite_deadlock.t b/t/zzzzzzz_sqlite_deadlock.t new file mode 100644 index 0000000..7bb0fe0 --- /dev/null +++ b/t/zzzzzzz_sqlite_deadlock.t @@ -0,0 +1,36 @@ +use strict; +use warnings; + +use Test::More; +use Test::Exception; +use lib 't/lib'; + +use File::Temp (); +use DBICTest; +use DBICTest::Schema; + +plan tests => 2; +my $wait_for = 10; # how many seconds to wait + +for my $close (0,1) { + + my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' ); + my $tmp_fn = $tmp->filename; + close $tmp if $close; + + local $SIG{ALRM} = sub { die sprintf ( + "Timeout of %d seconds reached (tempfile still open: %s)", + $wait_for, $close ? 'No' : 'Yes' + )}; + + alarm $wait_for; + + lives_ok (sub { + my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); + warn $tmp_fn; + DBICTest->deploy_schema ($schema); + DBICTest->populate_schema ($schema); + }); + + alarm 0; +}