From: Peter Rabbitson Date: Mon, 6 Sep 2010 08:41:46 +0000 (+0200) Subject: Speed up sqlite-based tests (disable synchronous disk writes) X-Git-Tag: 0.07002~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=be9f4d42a56c7cc4b7c0940edaca6c4735b9ccac;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Speed up sqlite-based tests (disable synchronous disk writes) --- diff --git a/t/10sqlite_common.t b/t/10sqlite_common.t index 6fe4b63..e3d52dc 100644 --- a/t/10sqlite_common.t +++ b/t/10sqlite_common.t @@ -13,7 +13,7 @@ my $tester = dbixcsl_common_tests->new( user => '', password => '', connect_info_opts => { - on_connect_do => 'PRAGMA foreign_keys = ON', + on_connect_do => [ 'PRAGMA foreign_keys = ON', 'PRAGMA synchronous = OFF', ] }, loader_options => { preserve_case => 1 }, data_types => { diff --git a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm index a67eb61..6edbe61 100644 --- a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm +++ b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm @@ -579,6 +579,9 @@ sub dbconnect { AutoCommit => 1, } ); + if ($self->{dsn} =~ /^[^:]+:SQLite:/) { + $dbh->do ('PRAGMA synchronous = OFF'); + } die "Failed to connect to database: $DBI::errstr" if !$dbh; diff --git a/t/backcompat/0.04006/lib/make_dbictest_db.pm b/t/backcompat/0.04006/lib/make_dbictest_db.pm index 6613288..d9a8083 100644 --- a/t/backcompat/0.04006/lib/make_dbictest_db.pm +++ b/t/backcompat/0.04006/lib/make_dbictest_db.pm @@ -12,6 +12,7 @@ my $fn = './t/dbictest.db'; unlink($fn); our $dsn = "dbi:$class:dbname=$fn"; my $dbh = DBI->connect($dsn); +$dbh->do ('PRAGMA SYNCHRONOUS = OFF'); $dbh->do($_) for ( q|CREATE TABLE foo ( diff --git a/t/lib/make_dbictest_db.pm b/t/lib/make_dbictest_db.pm index 99ad862..118800b 100644 --- a/t/lib/make_dbictest_db.pm +++ b/t/lib/make_dbictest_db.pm @@ -12,6 +12,7 @@ my $fn = './t/dbictest.db'; unlink($fn); our $dsn = "dbi:$class:dbname=$fn"; my $dbh = DBI->connect($dsn); +$dbh->do('PRAGMA SYNCHRONOUS = OFF'); $dbh->do($_) for ( q|CREATE TABLE foo ( diff --git a/t/lib/make_dbictest_db_clashing_monikers.pm b/t/lib/make_dbictest_db_clashing_monikers.pm index 5f37fea..37741bb 100644 --- a/t/lib/make_dbictest_db_clashing_monikers.pm +++ b/t/lib/make_dbictest_db_clashing_monikers.pm @@ -12,6 +12,7 @@ my $fn = './t/dbictest_clashing_tables.db'; unlink($fn); our $dsn = "dbi:$class:dbname=$fn"; my $dbh = DBI->connect($dsn); +$dbh->do('PRAGMA SYNCHRONOUS = OFF'); $dbh->do($_) for ( q|CREATE TABLE foo ( diff --git a/t/lib/make_dbictest_db_with_unique.pm b/t/lib/make_dbictest_db_with_unique.pm index 6b6ab17..6f75ad3 100644 --- a/t/lib/make_dbictest_db_with_unique.pm +++ b/t/lib/make_dbictest_db_with_unique.pm @@ -12,6 +12,7 @@ my $fn = './t/dbictest_with_unique.db'; unlink($fn); our $dsn = "dbi:$class:dbname=$fn"; my $dbh = DBI->connect($dsn); +$dbh->do('PRAGMA SYNCHRONOUS = OFF'); $dbh->do($_) for ( q|CREATE TABLE foos (