Commit | Line | Data |
d7b94f7a |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use Test::Exception; |
6 | use lib 't/lib'; |
7 | |
8 | use File::Temp (); |
9 | use DBICTest; |
10 | use DBICTest::Schema; |
11 | |
12 | plan tests => 2; |
13 | my $wait_for = 10; # how many seconds to wait |
14 | |
15 | for my $close (0,1) { |
16 | |
f86589ef |
17 | my $tmp = File::Temp->new( |
18 | UNLINK => 1, |
19 | TMPDIR => 1, |
20 | SUFFIX => '.sqlite', |
21 | EXLOCK => 0, # important for BSD and derivatives |
22 | ); |
23 | |
d7b94f7a |
24 | my $tmp_fn = $tmp->filename; |
25 | close $tmp if $close; |
26 | |
27 | local $SIG{ALRM} = sub { die sprintf ( |
28 | "Timeout of %d seconds reached (tempfile still open: %s)", |
29 | $wait_for, $close ? 'No' : 'Yes' |
30 | )}; |
31 | |
32 | alarm $wait_for; |
33 | |
34 | lives_ok (sub { |
35 | my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); |
d7b94f7a |
36 | DBICTest->deploy_schema ($schema); |
f86589ef |
37 | #DBICTest->populate_schema ($schema); |
d7b94f7a |
38 | }); |
39 | |
40 | alarm 0; |
41 | } |