of storage capabilities
- Fixed carp_once only emitting one single warning per package
regardless of warning content
+ - Test suite now can be safely executed in parallel (prove -jN
+ or HARNESS_OPTIONS=jN)
0.08196 2011-11-29 05:35 (UTC)
* Fixes
}
}
-# Bail out on parallel testing
-if (
- ($ENV{HARNESS_OPTIONS}||'') =~ / (?: ^ | \: ) j(\d+) /x
- and
- $1 > 1
-) { die <<EOP }
-
-******************************************************************************
-******************************************************************************
-*** ***
-*** PARALLEL TESTING DETECTED ( \$ENV{HARNESS_OPTIONS} = 'j$1' ) ***
-*** ***
-*** DBIC tests WILL FAIL. It is harder to make them parallel-friendly than ***
-*** it should be (though work is underway). In the meantime you will have ***
-*** to adjust your environment and re-run the installation. Sorry! ***
-*** ***
-******************************************************************************
-******************************************************************************
-
-EOP
-
# this is so we can order requires alphabetically
# copies are needed for potential author requires injection
my $reqs = {
use Test::More;
use lib qw(t/lib);
+use DBICTest;
use DBICTest::ForeignComponent;
# Tests if foreign component was loaded by calling foreign's method
use warnings;
use Test::More;
-unshift(@INC, './t/lib');
-
-plan tests => 4;
+use lib 't/lib';
+use DBICTest;
my $warnings;
eval {
my $rset_a = DBICTest::Schema->resultset('Artist');
isa_ok($rset_a, 'DBIx::Class::ResultSet');
+done_testing;
use Test::More;
use lib qw(t/lib);
+use DBICTest;
plan tests => 4;
my $exp_warn = qr/The many-to-many relationship 'bars' is trying to create/;
use Test::More;
use Test::Exception;
+use lib 't/lib';
+use DBICTest;
+
throws_ok (
sub {
package BuggyTable;
use Test::Warn;
use lib qw(t/lib);
+use DBICTest;
warnings_exist { require DBICTest::ResultSetManager }
[
use strict;
use warnings;
use Test::More;
+
+use lib qw(t/lib);
+use DBICTest;
use DBIx::Class::Optional::Dependencies ();
+my $main_pid = $$;
+
plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
$num_children = 10;
}
-plan tests => ($num_children*2) + 6;
-
-use lib qw(t/lib);
-
-use_ok('DBICTest::Schema');
-
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 1 });
my $parent_rs;
ok(1, "Made it to the end");
-$schema->storage->dbh->do("DROP TABLE cd");
+done_testing;
+
+END {
+ $schema->storage->dbh->do("DROP TABLE cd") if ($schema and $main_pid == $$);
+ undef $schema;
+}
use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
+use DBICTest;
plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
use DBIx::Class::Optional::Dependencies ();
use Scalar::Util 'weaken';
use lib qw(t/lib);
+use DBICTest;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
}
);
+ # unicode is tricky, and now we happen to invoke it early via a
+ # regex in connection()
+ return $obj if (ref $obj) =~ /^utf8/;
+
# Test Builder is now making a new object for every pass/fail (que bloat?)
# and as such we can't really store any of its objects (since it will
# re-populate the registry while checking it, ewwww!)
use Test::More;
use Test::Exception;
use lib qw(t/lib);
+use DBICTest;
throws_ok (
sub { $ENV{PATH} . (kill (0)) },
use Test::More;
+use lib 't/lib';
+use DBICTest;
+
use File::Find;
use File::Spec;
use B qw/svref_2object/;
use Test::More;
use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
+use DBICTest::RunMode;
use DBIC::SqlMakerTest;
use DBIx::Class::SQLMaker::LimitDialects;
);
}
+use DBICTest;
use DBICTest::Schema;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
use Time::HiRes qw/time sleep/;
use lib qw(t/lib);
-use DBICTest; # do not remove even though it is not used
+use DBICTest;
my ($dsn, $user, $pass);
unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql');
}
+# this is just to grab a lock
+{
+ my $s = DBICTest::Schema->connect($dsn, $user, $pass);
+}
+
use_ok('DBICVersion_v1');
my $version_table_name = 'dbix_class_schema_versions';
my $old_table_name = 'SchemaVersions';
-my $ddl_dir = dir ('t', 'var');
-mkdir ($ddl_dir) unless -d $ddl_dir;
+my $ddl_dir = dir(qw/t var/, "versioning_ddl-$$");
+$ddl_dir->mkpath unless -d $ddl_dir;
my $fn = {
v1 => $ddl_dir->file ('DBICVersion-Schema-1.0-MySQL.sql'),
ok($get_db_version_run == 0, "attributes pulled from list connect_info");
}
-unless ($ENV{DBICTEST_KEEP_VERSIONING_DDL}) {
- unlink $_ for (values %$fn);
+END {
+ unless ($ENV{DBICTEST_KEEP_VERSIONING_DDL}) {
+ $ddl_dir->rmtree;
+ }
}
done_testing;
use Test::More;
+use lib 't/lib';
+use DBICTest;
+
BEGIN {
require DBIx::Class;
plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
use_ok 'DBIx::Class::Admin';
-my $sql_dir = dir(qw/t var/);
-my @connect_info = DBICTest->_database(
- no_deploy=>1,
- no_populate=>1,
- sqlite_use_file => 1,
+# lock early
+DBICTest->init_schema(no_deploy => 1, no_populate => 1);
+
+my $db_fn = DBICTest->_sqlite_dbfilename;
+my @connect_info = (
+ "dbi:SQLite:$db_fn",
+ undef,
+ undef,
+ { on_connect_do => 'PRAGMA synchronous = OFF' },
);
+my $ddl_dir = dir(qw/t var/, "admin_ddl-$$");
{ # create the schema
# make sure we are clean
-clean_dir($sql_dir);
+clean_dir($ddl_dir);
my $admin = DBIx::Class::Admin->new(
schema_class=> "DBICTest::Schema",
- sql_dir=> $sql_dir,
+ sql_dir=> $ddl_dir,
connect_info => \@connect_info,
);
isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object');
{ # upgrade schema
-clean_dir($sql_dir);
+clean_dir($ddl_dir);
require DBICVersion_v1;
my $admin = DBIx::Class::Admin->new(
schema_class => 'DBICVersion::Schema',
- sql_dir => $sql_dir,
+ sql_dir => $ddl_dir,
connect_info => \@connect_info,
);
require DBICVersion_v2;
-DBICVersion::Schema->upgrade_directory (undef); # so that we can test use of $sql_dir
+DBICVersion::Schema->upgrade_directory (undef); # so that we can test use of $ddl_dir
$admin = DBIx::Class::Admin->new(
schema_class => 'DBICVersion::Schema',
- sql_dir => $sql_dir,
+ sql_dir => $ddl_dir,
connect_info => \@connect_info
);
{ # install
-clean_dir($sql_dir);
+clean_dir($ddl_dir);
my $admin = DBIx::Class::Admin->new(
schema_class => 'DBICVersion::Schema',
- sql_dir => $sql_dir,
+ sql_dir => $ddl_dir,
_confirm => 1,
connect_info => \@connect_info,
);
lives_ok { $admin->install("4.0") } 'can force install to allready existing version'
}, qr/Forcing install may not be a good idea/, 'Force warning emitted' );
is($admin->schema->get_db_version, "4.0", 'db thinks its version 4.0');
-#clean_dir($sql_dir);
}
sub clean_dir {
my ($dir) = @_;
- $dir = $dir->resolve;
- if ( ! -d $dir ) {
- $dir->mkpath();
- }
- foreach my $file ($dir->children) {
- # skip any hidden files
- next if ($file =~ /^\./);
- unlink $file;
- }
+ $dir->rmtree if -d $dir;
+ unlink $db_fn;
+}
+
+END {
+ clean_dir($ddl_dir);
}
done_testing;
}
sub default_args {
+ my $dbname = DBICTest->_sqlite_dbfilename;
return (
qw|--quiet --schema=DBICTest::Schema --class=Employee|,
- q|--connect=["dbi:SQLite:dbname=t/var/DBIxClass.db","","",{"AutoCommit":1}]|,
+ qq|--connect=["dbi:SQLite:dbname=$dbname","","",{"AutoCommit":1}]|,
qw|--force -I testincludenoniterference|,
);
}
}
done_testing;
-
-END { unlink $DB if -e $DB }
-
__PACKAGE__->load_components(qw/CDBICompat Core DB/);
-use File::Temp qw/tempfile/;
-my (undef, $DB) = tempfile();
-END { unlink $DB if -e $DB }
-
+my $DB = DBICTest->_sqlite_dbfilename;
my @DSN = ("dbi:SQLite:dbname=$DB", '', '', { AutoCommit => 1, RaiseError => 1 });
__PACKAGE__->connection(@DSN);
MyBase;
use strict;
-use base qw(DBIx::Class::CDBICompat);
-
use DBI;
+use lib 't/lib';
+use DBICTest;
+
+use base qw(DBIx::Class::CDBICompat);
+
our $dbh;
my $err;
}
my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0});
+# this is only so we grab a lock on mysql
+{
+ my $x = DBICTest::Schema->connect(@connect);
+}
+
$dbh = DBI->connect(@connect) or die DBI->errstr;
my @table;
use warnings;
use DBICTest::RunMode;
use DBICTest::Schema;
-use DBICTest::Util qw/populate_weakregistry assert_empty_weakregistry/;
+use DBICTest::Util qw/populate_weakregistry assert_empty_weakregistry local_umask/;
use Carp;
use Path::Class::File ();
+use File::Spec;
+use Fcntl qw/:flock/;
=head1 NAME
=cut
-sub has_custom_dsn {
- return $ENV{"DBICTEST_DSN"} ? 1:0;
+# some tests are very time sensitive and need to run on their own, without
+# being disturbed by anything else grabbing CPU or disk IO. Hence why everything
+# using DBICTest grabs a shared lock, and the few tests that request a :GlobalLock
+# will ask for an exclusive one and block until they can get it
+our ($global_lock_fh, $global_exclusive_lock);
+sub import {
+ my $self = shift;
+
+ my $lockpath = File::Spec->tmpdir . '/.dbictest_global.lock';
+
+ {
+ my $u = local_umask(0); # so that the file opens as 666, and any user can lock
+ open ($global_lock_fh, '>', $lockpath)
+ or die "Unable to open $lockpath: $!";
+ }
+
+ for (@_) {
+ if ($_ eq ':GlobalLock') {
+ flock ($global_lock_fh, LOCK_EX) or die "Unable to lock $lockpath: $!";
+ $global_exclusive_lock = 1;
+ }
+ else {
+ croak "Unknown export $_ requested from $self";
+ }
+ }
+
+ unless ($global_exclusive_lock) {
+ flock ($global_lock_fh, LOCK_SH) or die "Unable to lock $lockpath: $!";
+ }
}
-sub _sqlite_dbfilename {
+END {
+ if ($global_lock_fh) {
+ # delay destruction even more
+ }
+}
+
+{
my $dir = Path::Class::File->new(__FILE__)->dir->parent->subdir('var');
$dir->mkpath unless -d "$dir";
- return $dir->file('DBIxClass.db')->stringify;
+ $dir = "$dir";
+
+ sub _sqlite_dbfilename {
+ my $holder = $ENV{DBICTEST_LOCK_HOLDER} || $$;
+ $holder = $$ if $holder == -1;
+
+ # useful for missing cleanup debugging
+ #if ( $holder == $$) {
+ # my $x = $0;
+ # $x =~ s/\//#/g;
+ # $holder .= "-$x";
+ #}
+
+ return "$dir/DBIxClass-$holder.db";
+ }
+
+ END {
+ _cleanup_dbfile();
+ }
+}
+
+$SIG{INT} = sub { _cleanup_dbfile(); exit 1 };
+
+sub _cleanup_dbfile {
+ # cleanup if this is us
+ if (
+ ! $ENV{DBICTEST_LOCK_HOLDER}
+ or
+ $ENV{DBICTEST_LOCK_HOLDER} == -1
+ or
+ $ENV{DBICTEST_LOCK_HOLDER} == $$
+ ) {
+ my $db_file = _sqlite_dbfilename();
+ unlink $_ for ($db_file, "${db_file}-journal");
+ }
+}
+
+sub has_custom_dsn {
+ return $ENV{"DBICTEST_DSN"} ? 1:0;
}
sub _sqlite_dbname {
use base 'DBIx::Class::Schema';
-use DBICTest::Util qw/populate_weakregistry assert_empty_weakregistry/;
+use Fcntl qw/:DEFAULT :seek :flock/;
+use Time::HiRes 'sleep';
+use Path::Class::File;
+use File::Spec;
+use DBICTest::Util qw/populate_weakregistry assert_empty_weakregistry local_umask/;
use namespace::clean;
__PACKAGE__->mk_group_accessors(simple => 'custom_attr');
$sqlt_schema->drop_table('dummy');
}
-my $weak_registry = {};
-sub clone {
- my $self = shift->next::method(@_);
- populate_weakregistry ( $weak_registry, $self )
- if $INC{'Test/Builder.pm'};
- $self;
+our $locker;
+END {
+ # we need the $locker to be referenced here for delayed destruction
+ if ($locker->{lock_name} and ($ENV{DBICTEST_LOCK_HOLDER}||0) == $$) {
+ #warn "$$ $0 $locktype LOCK RELEASED";
+ }
}
+my $weak_registry = {};
+
sub connection {
my $self = shift->next::method(@_);
+# MASSIVE FIXME
+# we can't really lock based on DSN, as we do not yet have a way to tell that e.g.
+# DBICTEST_MSSQL_DSN=dbi:Sybase:server=192.168.0.11:1433;database=dbtst
+# and
+# DBICTEST_MSSQL_ODBC_DSN=dbi:ODBC:server=192.168.0.11;port=1433;database=dbtst;driver=FreeTDS;tds_version=8.0
+# are the same server
+# hence we lock everything based on sqlt_type or just globally if not available
+# just pretend we are python you know? :)
+
+
+ # when we get a proper DSN resolution sanitize to produce a portable lockfile name
+ # this may look weird and unnecessary, but consider running tests from
+ # windows over a samba share >.>
+ #utf8::encode($dsn);
+ #$dsn =~ s/([^A-Za-z0-9_\-\.\=])/ sprintf '~%02X', ord($1) /ge;
+ #$dsn =~ s/^dbi/dbi/i;
+
+ # provide locking for physical (non-memory) DSNs, so that tests can
+ # safely run in parallel. While the harness (make -jN test) does set
+ # an envvar, we can not detect when a user invokes prove -jN. Hence
+ # perform the locking at all times, it shouldn't hurt.
+ # the lock fh *should* inherit across forks/subprocesses
+ #
+ # File locking is hard. Really hard. By far the best lock implementation
+ # I've seen is part of the guts of File::Temp. However it is sadly not
+ # reusable. Since I am not aware of folks doing NFS parallel testing,
+ # nor are we known to work on VMS, I am just going to punt this and
+ # use the portable-ish flock() provided by perl itself. If this does
+ # not work for you - patches more than welcome.
+ if (
+ ! $DBICTest::global_exclusive_lock
+ and
+ ( ! $ENV{DBICTEST_LOCK_HOLDER} or $ENV{DBICTEST_LOCK_HOLDER} == $$ )
+ and
+ ref($_[0]) ne 'CODE'
+ and
+ ($_[0]||'') !~ /^ (?i:dbi) \: SQLite \: (?: dbname\= )? (?: \:memory\: | t [\/\\] var [\/\\] DBIxClass\-) /x
+ ) {
+
+ my $locktype = do {
+ # guard against infinite recursion
+ local $ENV{DBICTEST_LOCK_HOLDER} = -1;
+
+ # we need to connect a forced fresh clone so that we do not upset any state
+ # of the main $schema (some tests examine it quite closely)
+ local $@;
+ my $storage = eval {
+ my $st = ref($self)->connect(@{$self->storage->connect_info})->storage;
+ $st->ensure_connected; # do connect here, to catch a possible throw
+ $st;
+ };
+ $storage
+ ? do {
+ my $t = $storage->sqlt_type || 'generic';
+ eval { $storage->disconnect };
+ $t;
+ }
+ : undef
+ ;
+ };
+
+
+ # Never hold more than one lock. This solves the "lock in order" issues
+ # unrelated tests may have
+ # 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';
+
+ my $lockpath = File::Spec->tmpdir . "/.dbictest_$locktype.lock";
+
+ my $lock_fh;
+ {
+ my $u = local_umask(0); # so that the file opens as 666, and any user can lock
+ sysopen ($lock_fh, $lockpath, O_RDWR|O_CREAT) or die "Unable to open $lockpath: $!";
+ }
+ flock ($lock_fh, LOCK_EX) or die "Unable to lock $lockpath: $!";
+ #warn "$$ $0 $locktype LOCK GRABBED";
+
+ # 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) ) {
+ for (1..50) {
+ kill (0, $old_pid) or last;
+ sleep 0.1;
+ }
+ }
+ #warn "$$ $0 $locktype POST GRAB WAIT";
+
+ truncate $lock_fh, 0;
+ seek ($lock_fh, 0, SEEK_SET) or die "seek failed $!";
+ $lock_fh->autoflush(1);
+ print $lock_fh $$;
+
+ $ENV{DBICTEST_LOCK_HOLDER} ||= $$;
+
+ $locker = {
+ type => $locktype,
+ fh => $lock_fh,
+ lock_name => "$lockpath",
+ };
+ }
+ }
+
if ($INC{'Test/Builder.pm'}) {
populate_weakregistry ( $weak_registry, $self->storage );
]);
}
+ return $self;
+}
+
+sub clone {
+ my $self = shift->next::method(@_);
+ populate_weakregistry ( $weak_registry, $self )
+ if $INC{'Test/Builder.pm'};
$self;
}
use Carp;
use Scalar::Util qw/isweak weaken blessed reftype refaddr/;
+use Config;
use base 'Exporter';
-our @EXPORT_OK = qw/stacktrace populate_weakregistry assert_empty_weakregistry/;
+our @EXPORT_OK = qw/local_umask stacktrace populate_weakregistry assert_empty_weakregistry/;
+
+sub local_umask {
+ return unless defined $Config{d_umask};
+
+ die 'Calling local_umask() in void context makes no sense'
+ if ! defined wantarray;
+
+ my $old_umask = umask(shift());
+ die "Setting umask failed: $!" unless defined $old_umask;
+
+ return bless \$old_umask, 'DBICTest::Util::UmaskGuard';
+}
+{
+ package DBICTest::Util::UmaskGuard;
+ sub DESTROY {
+ local ($@, $!);
+ eval { defined (umask ${$_[0]}) or die };
+ warn ( "Unable to reset old umask ${$_[0]}: " . ($!||'Unknown error') )
+ if ($@ || $!);
+ }
+}
+
sub stacktrace {
my $frame = shift;
__PACKAGE__->register_class('Table', 'DBICVersion::Table');
__PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
-__PACKAGE__->upgrade_directory('t/var/');
+__PACKAGE__->upgrade_directory("t/var/versioning_ddl-$$");
sub ordered_schema_versions {
return('1.0','2.0','3.0');
__PACKAGE__->register_class('Table', 'DBICVersion::Table');
__PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
-__PACKAGE__->upgrade_directory('t/var/');
-__PACKAGE__->backup_directory('t/var/backup/');
+__PACKAGE__->upgrade_directory("t/var/versioning_ddl-$$");
+__PACKAGE__->backup_directory("t/var/versioning_backup-$$");
1;
__PACKAGE__->register_class('Table', 'DBICVersion::Table');
__PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
-__PACKAGE__->upgrade_directory('t/var/');
-__PACKAGE__->backup_directory('t/var/backup/');
+__PACKAGE__->upgrade_directory("t/var/versioning_ddl-$$");
+__PACKAGE__->backup_directory("t/var/versioning_backup-$$");
1;
admin => 1
};
-ok( my $schema = My::Schema->connection(DBICTest->_database) );
+ok( my $schema = My::Schema->connect(DBICTest->_database) );
ok(
$schema->storage->dbh->do(
use Test::Exception;
use Data::Dumper::Concise;
use lib qw(t/lib);
+use DBICTest;
use DBIC::SqlMakerTest;
use DBIx::Class::SQLMaker::Oracle;
BEGIN { delete @ENV{qw(DBI_DSN DBI_DRIVER)} }
-my $schema;
+$ENV{DBICTEST_LOCK_HOLDER} = -1;
-DBICTest->init_schema(sqlite_use_file => 1);
+# pre-populate
+my $schema = DBICTest->init_schema(sqlite_use_file => 1);
my $dbname = DBICTest->_sqlite_dbname(sqlite_use_file => 1);
my $schema = DBICTest->init_schema();
-my $lfn = file('t/var/sql.log');
+my $lfn = file("t/var/sql-$$.log");
unlink $lfn or die $!
if -e $lfn;
$schema->storage->debugobj->debugfh(undef)
}
+END {
+ unlink $lfn;
+}
+
open(STDERRCOPY, '>&STDERR');
close(STDERR);
dies_ok {
use File::Spec;
use Path::Class qw/dir/;
-use File::Path qw/make_path remove_tree/;
lives_ok( sub {
my $parse_schema = DBICTest->init_schema(no_deploy => 1);
my $schema = DBICTest->init_schema();
-my $var = dir (qw| t var create_ddl_dir |);
--d $var
- or make_path( "$var" )
- or die "can't create $var: $!";
+my $var = dir ("t/var/ddl_dir-$$");
+$var->mkpath unless -d $var;
my $test_dir_1 = $var->subdir ('test1', 'foo', 'bar' );
-remove_tree( "$test_dir_1" ) if -d $test_dir_1;
+$test_dir_1->rmtree if -d $test_dir_1;
$schema->create_ddl_dir( undef, undef, $test_dir_1 );
ok( -d $test_dir_1, 'create_ddl_dir did a make_path on its target dir' );
ok( 0 );
}
+END {
+ $var->rmtree;
+}
+
done_testing;
use Test::Exception;
use lib qw(t/lib);
-use base 'DBICTest';
+use DBICTest;
require DBI;
MSSQL_ODBC => 'DBIx::Class::Storage::DBI::MSSQL',
);
+# lie that we already locked stuff - the tests below do not touch anything
+$ENV{DBICTEST_LOCK_HOLDER} = -1;
+
# Make sure oracle is tried last - some clients (e.g. 10.2) have symbol
# clashes with libssl, and will segfault everything coming after them
for my $db (sort {
use lib qw(t/lib);
use DBICTest;
-my $db_orig = "$FindBin::Bin/../var/DBIxClass.db";
+my $db_orig = DBICTest->_sqlite_dbfilename;
my $db_tmp = "$db_orig.tmp";
# Set up the "usual" sqlite for DBICTest
use Test::More;
use Benchmark;
use lib qw(t/lib);
-use DBICTest; # do not remove even though it is not used
+use DBICTest ':GlobalLock';
# This is a rather unusual test.
# It does not test any aspect of DBIx::Class, but instead tests the
use warnings;
use Test::More;
-use Test::Exception;
-use lib 't/lib';
-use File::Temp ();
-use DBICTest;
-use DBICTest::Schema;
+use lib 't/lib';
+use DBICTest::RunMode;
if ( DBICTest::RunMode->is_plain ) {
plan( skip_all => "Skipping test on plain module install" );
}
+use Test::Exception;
+use DBICTest;
+use File::Temp ();
+
plan tests => 2;
my $wait_for = 120; # how many seconds to wait
+# 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',
+ DIR => 't/var',
+ SUFFIX => '.db',
+ TEMPLATE => 'DBIxClass-XXXXXX',
EXLOCK => 0, # important for BSD and derivatives
);
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);
+ DBICTest->populate_schema ($schema);
});
alarm 0;