From: Peter Rabbitson Date: Sun, 1 Nov 2015 12:08:12 +0000 (+0100) Subject: Fix failures and protect the suite from spurious VERSION-related warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da9346a03a7df80d02f40584422af71fbd2ca4f8;p=dbsrgits%2FDBIx-Class.git Fix failures and protect the suite from spurious VERSION-related warnings A new SQL::Translator devrel missed a s/_// line and made several tests fail Fix t/752sqlite.t and t/icdt/offline_pg.t, and also add an obnoxious CI mode to ensure we will not fall prey to this again --- diff --git a/.travis.yml b/.travis.yml index 672d3ac..d6f2789 100644 --- a/.travis.yml +++ b/.travis.yml @@ -167,6 +167,7 @@ matrix: - DBIC_TRACE=1 - DBIC_TRACE_PROFILE=console_monochrome - DBICTEST_VIA_REPLICATED=0 + - DBICTEST_VERSION_WARNS_INDISCRIMINATELY=1 ### # Start of the allow_failures block @@ -186,6 +187,7 @@ matrix: - DEVREL_DEPS=true - POISON_ENV=true - DBIC_TRACE=1 + - DBICTEST_VERSION_WARNS_INDISCRIMINATELY=1 - BREWVER=5.8.1 # 5.8.3 with blead CPAN @@ -209,6 +211,7 @@ matrix: - perl: devcpan_5.8.8_thr_mb env: - CLEANTEST=true + - DBICTEST_VERSION_WARNS_INDISCRIMINATELY=1 - DEVREL_DEPS=true - BREWVER=5.8.8 - BREWOPTS="-Duseithreads -Dusemorebits" diff --git a/maint/travis-ci_scripts/40_script.bash b/maint/travis-ci_scripts/40_script.bash index c329a93..3b8b110 100755 --- a/maint/travis-ci_scripts/40_script.bash +++ b/maint/travis-ci_scripts/40_script.bash @@ -37,7 +37,12 @@ else fi TEST_T1=$SECONDS -if [[ -z "$DBIC_TRACE" ]] && [[ -z "$DBIC_MULTICREATE_DEBUG" ]] && [[ -s "$TEST_STDERR_LOG" ]] ; then +if \ + [[ -z "$DBIC_TRACE" ]] \ +&& [[ -z "$DBIC_MULTICREATE_DEBUG" ]] \ +&& [[ -z "$DBICTEST_DEBUG_CONCURRENCY_LOCKS" ]] \ +&& [[ -z "$DBICTEST_VERSION_WARNS_INDISCRIMINATELY" ]] \ +&& [[ -s "$TEST_STDERR_LOG" ]] ; then STDERR_LOG_SIZE=$(wc -l < "$TEST_STDERR_LOG") # prepend STDERR log diff --git a/t/752sqlite.t b/t/752sqlite.t index c07327e..f61f07e 100644 --- a/t/752sqlite.t +++ b/t/752sqlite.t @@ -11,6 +11,10 @@ use lib qw(t/lib); use DBICTest; use DBIx::Class::_Util qw( sigwarn_silencer modver_gt_or_eq modver_gt_or_eq_and_lt ); +# make one deploy() round before we load anything else - need this in order +# to prime SQLT if we are using it (deep depchain is deep) +DBICTest->init_schema( no_populate => 1 ); + # check that we work somewhat OK with braindead SQLite transaction handling # # As per https://metacpan.org/source/ADAMK/DBD-SQLite-1.37/lib/DBD/SQLite.pm#L921 @@ -18,8 +22,6 @@ use DBIx::Class::_Util qw( sigwarn_silencer modver_gt_or_eq modver_gt_or_eq_and_ # # However DBD::SQLite 1.38_02 seems to fix this, with an accompanying test: # https://metacpan.org/source/ADAMK/DBD-SQLite-1.38_02/t/54_literal_txn.t - -require DBD::SQLite; my $lit_txn_todo = modver_gt_or_eq('DBD::SQLite', '1.38_02') ? undef : "DBD::SQLite before 1.38_02 is retarded wrt detecting literal BEGIN/COMMIT statements" diff --git a/t/icdt/offline_pg.t b/t/icdt/offline_pg.t index aca2cc3..0c0cb9b 100644 --- a/t/icdt/offline_pg.t +++ b/t/icdt/offline_pg.t @@ -27,6 +27,10 @@ DBICTest::Schema->load_classes('EventTZPg'); my $schema = DBICTest->init_schema(); +# this may generate warnings under certain CI flags, hence do it outside of +# the warnings_are below +my $dt = DateTime->new( year => 2000, time_zone => "America/Chicago" ); + warnings_are { my $event = $schema->resultset("EventTZPg")->find(1); $event->update({created_on => '2009-01-15 17:00:00+00'}); diff --git a/t/lib/DBICTest/RunMode.pm b/t/lib/DBICTest/RunMode.pm index ee16bc1..b8664db 100644 --- a/t/lib/DBICTest/RunMode.pm +++ b/t/lib/DBICTest/RunMode.pm @@ -13,6 +13,18 @@ BEGIN { die __PACKAGE__ . " must be loaded before DBIx::Class (or modules using DBIx::Class) at $frame[1] line $frame[2]\n"; } + + if ( $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY} ) { + my $ov = UNIVERSAL->can("VERSION"); + + require Carp; + + no warnings 'redefine'; + *UNIVERSAL::VERSION = sub { + Carp::carp( 'Argument "blah bleh bloh" isn\'t numeric in subroutine entry' ); + &$ov; + }; + } } use Path::Class qw/file dir/; diff --git a/xt/dist/loadable_standalone_testschema_resultclasses.t b/xt/dist/loadable_standalone_testschema_resultclasses.t index 7ed0381..f0dd2ac 100644 --- a/xt/dist/loadable_standalone_testschema_resultclasses.t +++ b/xt/dist/loadable_standalone_testschema_resultclasses.t @@ -1,6 +1,8 @@ use warnings; use strict; +BEGIN { delete $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY} } + use DBIx::Class::_Util 'sigwarn_silencer'; use if DBIx::Class::_ENV_::BROKEN_FORK, 'threads'; diff --git a/xt/extra/dbicadmin.t b/xt/extra/dbicadmin.t index e65ad7d..cc79190 100644 --- a/xt/extra/dbicadmin.t +++ b/xt/extra/dbicadmin.t @@ -6,6 +6,7 @@ use warnings; BEGIN { # just in case the user env has stuff in it delete $ENV{JSON_ANY_ORDER}; + delete $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY}; } use Test::More;