From: Peter Rabbitson Date: Tue, 15 Dec 2015 22:26:07 +0000 (+0100) Subject: Cleaner assertion envvar handling X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db83437ef48f4571e1d225572cc7235eb5e64fe3;p=dbsrgits%2FDBIx-Class-Historic.git Cleaner assertion envvar handling No functional changes, aside from making few envvars always set on CI --- diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index bfb6a2a..3c14189 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -29,15 +29,21 @@ BEGIN { # add an escape for these perls ON SMOKERS - a user will still get death PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ( "$]" >= 5.013005 and "$]" <= 5.013006) ), - SHUFFLE_UNORDERED_RESULTSETS => $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} ? 1 : 0, - - ASSERT_NO_INTERNAL_WANTARRAY => $ENV{DBIC_ASSERT_NO_INTERNAL_WANTARRAY} ? 1 : 0, - - ASSERT_NO_INTERNAL_INDIRECT_CALLS => $ENV{DBIC_ASSERT_NO_INTERNAL_INDIRECT_CALLS} ? 1 : 0, - - STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE => $ENV{DBIC_STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE} ? 1 : 0, - - STRESSTEST_COLUMN_INFO_UNAWARE_STORAGE => $ENV{DBIC_STRESSTEST_COLUMN_INFO_UNAWARE_STORAGE} ? 1 : 0, + ( map + # + # the "DBIC_" prefix below is crucial - this is what makes CI pick up + # all envvars without further adjusting its scripts + # DO NOT CHANGE to the more logical { $_ => !!( $ENV{"DBIC_$_"} ) } + # + { substr($_, 5) => !!( $ENV{$_} ) } + qw( + DBIC_SHUFFLE_UNORDERED_RESULTSETS + DBIC_ASSERT_NO_INTERNAL_WANTARRAY + DBIC_ASSERT_NO_INTERNAL_INDIRECT_CALLS + DBIC_STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE + DBIC_STRESSTEST_COLUMN_INFO_UNAWARE_STORAGE + ) + ), IV_SIZE => $Config{ivsize}, diff --git a/maint/travis-ci_scripts/20_install.bash b/maint/travis-ci_scripts/20_install.bash index aab2e7e..79c4b26 100755 --- a/maint/travis-ci_scripts/20_install.bash +++ b/maint/travis-ci_scripts/20_install.bash @@ -68,11 +68,26 @@ CPAN_CFG_SCRIPT=" " run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'" + +# These envvars are always set, more *maybe* below +export DBIC_SHUFFLE_UNORDERED_RESULTSETS=1 + +# bogus nonexisting DBI_* +export DBI_DSN="dbi:ODBC:server=NonexistentServerAddress" +export DBI_DRIVER="ADO" + +# some people do in fact set this - boggle!!! +# it of course won't work before 5.8.4 +if perl -M5.008004 -e 1 &>/dev/null ; then + export PERL_STRICTURES_EXTRA=1 +fi + + # poison the environment if [[ "$POISON_ENV" = "true" ]] ; then # look through lib, find all mentioned DBIC* ENVvars and set them to true and see if anything explodes - toggle_booleans=( $(grep -P '\$ENV\{' -r lib/ --exclude-dir Optional | grep -oP '\bDBIC\w+' | sort -u | grep -vP '^(DBIC_TRACE(_PROFILE)?|DBIC_.+_DEBUG)$') ) + toggle_booleans=( $( grep -ohP '\bDBIC_[0-9_A-Z]+' -r lib/ --exclude-dir Optional | sort -u | grep -vP '^(DBIC_TRACE(_PROFILE)?|DBIC_.+_DEBUG)$' ) ) # some extra pollutants toggle_booleans+=( \ @@ -87,12 +102,6 @@ if [[ "$POISON_ENV" = "true" ]] ; then toggle_booleans+=( DBICTEST_VIA_REPLICATED ) fi - # some people do in fact set this - boggle!!! - # it of course won't work before 5.8.4 - if perl -M5.008004 -e 1 &>/dev/null ; then - toggle_booleans+=( PERL_STRICTURES_EXTRA ) - fi - for var in "${toggle_booleans[@]}" do if [[ -z "${!var}" ]] ; then @@ -101,10 +110,6 @@ if [[ "$POISON_ENV" = "true" ]] ; then fi done - # bogus nonexisting DBI_* - export DBI_DSN="dbi:ODBC:server=NonexistentServerAddress" - export DBI_DRIVER="ADO" - # emulate a local::lib-like env # trick cpanm into executing true as shell - we just need the find+unpack run_or_err "Downloading latest stable DBIC from CPAN" \ diff --git a/t/storage/debug.t b/t/storage/debug.t index 6868795..3f5d399 100644 --- a/t/storage/debug.t +++ b/t/storage/debug.t @@ -2,7 +2,14 @@ use strict; use warnings; no warnings 'once'; -BEGIN { $ENV{DBICTEST_VIA_REPLICATED} = 0 } +BEGIN { + delete @ENV{qw( + DBIC_TRACE + DBIC_TRACE_PROFILE + DBICTEST_SQLITE_USE_FILE + DBICTEST_VIA_REPLICATED + )}; +} use Test::More; use Test::Exception; @@ -12,8 +19,6 @@ use lib qw(t/lib); use DBICTest; use Path::Class qw/file/; -BEGIN { delete @ENV{qw(DBIC_TRACE DBIC_TRACE_PROFILE DBICTEST_SQLITE_USE_FILE)} } - my $schema = DBICTest->init_schema(); my $lfn = file("t/var/sql-$$.log"); diff --git a/t/storage/global_destruction.t b/t/storage/global_destruction.t index 4fb49cb..6bddfd7 100644 --- a/t/storage/global_destruction.t +++ b/t/storage/global_destruction.t @@ -3,6 +3,9 @@ use warnings; use Test::More; +# so we can see the retry exceptions (if any) +BEGIN { $ENV{DBIC_STORAGE_RETRY_DEBUG} = 1 } + use DBIx::Class::Optional::Dependencies (); use lib qw(t/lib); @@ -35,9 +38,6 @@ for my $type (qw/PG MYSQL SQLite/) { # to induce out-of-order destruction $DBICTest::FakeSchemaFactory::schema = $schema; - # so we can see the retry exceptions (if any) - $ENV{DBIC_DBIRETRY_DEBUG} = 1; - ok (!$schema->storage->connected, "$type: start disconnected"); $schema->txn_do (sub {