# prove) but I do not know it offhand, especially on older environments
# Go with the safer option
if ($INC{'Test/Builder.pm'}) {
- local $| = 1;
- print "#\n";
+ select( ( select(\*STDOUT), $|=1 )[0] );
+ print STDOUT "#\n";
}
}
dbg DEBUG_TEST_CONCURRENCY_LOCKS PEEPEENESS
);
use DBICTest::Util::LeakTracer qw/populate_weakregistry assert_empty_weakregistry/;
+
+# The actual ASSERT logic is in BaseSchema for pesky load-order reasons
+# Hence run this through once, *before* DBICTest::Schema and friends load
+BEGIN {
+ if (
+ DBIx::Class::_ENV_::ASSERT_NO_ERRONEOUS_METAINSTANCE_USE
+ or
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS
+ ) {
+ require DBIx::Class::Row;
+ require DBICTest::BaseSchema;
+ DBICTest::BaseSchema->connect( sub {} );
+ }
+}
+
use DBICTest::Schema;
-use DBIx::Class::_Util qw( detected_reinvoked_destructor scope_guard );
+use DBIx::Class::_Util qw( detected_reinvoked_destructor scope_guard modver_gt_or_eq );
use Carp;
use Fcntl qw/:DEFAULT :flock/;
use Config;
my $clan_connect_caller = '*UNKNOWN*';
my $i;
- while ( my ($pack, $file, $line) = caller(++$i) ) {
+ while ( my ($pack, $file, $line) = CORE::caller(++$i) ) {
next if $file eq __FILE__;
next if $pack =~ /^DBIx::Class|^Try::Tiny/;
$clan_connect_caller = "$file line $line";
my $schema;
if (
- $ENV{DBICTEST_VIA_REPLICATED} &&=
- ( !$args{storage_type} && !defined $args{sqlite_use_file} )
+ $ENV{DBICTEST_VIA_REPLICATED} &&= (
+ !$args{storage_type}
+ &&
+ ( ! defined $args{sqlite_use_file} or $args{sqlite_use_file} )
+ )
) {
$args{storage_type} = ['::DBI::Replicated', { balancer_type => '::Random' }];
$args{sqlite_use_file} = 1;
if ( !$args{no_connect} ) {
$schema->connection(@dsn);
- $schema->storage->connect_replicants(\@dsn)
- if $ENV{DBICTEST_VIA_REPLICATED};
+ if( $ENV{DBICTEST_VIA_REPLICATED} ) {
+
+ # add explicit ReadOnly=1 if we can support it
+ $dsn[0] =~ /^dbi:SQLite:/i
+ and
+ require DBD::SQLite
+ and
+ modver_gt_or_eq('DBD::SQLite', '1.49_05')
+ and
+ $dsn[0] =~ s/^dbi:SQLite:/dbi:SQLite(ReadOnly=1):/i;
+
+ $schema->storage->connect_replicants(\@dsn);
+ }
}
if ( !$args{no_deploy} ) {