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;
+ };
+ }
+
+ if (
+ $ENV{DBICTEST_ASSERT_NO_SPURIOUS_EXCEPTION_ACTION}
+ or
+ # keep it always on during CI
+ (
+ ($ENV{TRAVIS}||'') eq 'true'
+ and
+ ($ENV{TRAVIS_REPO_SLUG}||'') =~ m|\w+/dbix-class$|
+ )
+ ) {
+ require Try::Tiny;
+ my $orig = \&Try::Tiny::try;
+
+ no warnings 'redefine';
+ *Try::Tiny::try = sub (&;@) {
+ my ($fr, $first_pkg) = 0;
+ while( $first_pkg = caller($fr++) ) {
+ last if $first_pkg !~ /^
+ __ANON__
+ |
+ \Q(eval)\E
+ $/x;
+ }
+
+ if ($first_pkg =~ /DBIx::Class/) {
+ require Test::Builder;
+ Test::Builder->new->ok(0,
+ 'Using try{} within DBIC internals is a mistake - use dbic_internal_try{} instead'
+ );
+ }
+
+ goto $orig;
+ };
+ }
}
use Path::Class qw/file dir/;
use Fcntl ':DEFAULT';
use File::Spec ();
use File::Temp ();
+use DBICTest::Util 'local_umask';
_check_author_makefile() unless $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION};
my $reason_dir_unusable;
my @parts = File::Spec->splitdir($dir);
- if (@parts == 2 and $parts[1] =~ /^ [ \\ \/ ]? $/x ) {
+ if (@parts == 2 and $parts[1] =~ /^ [\/\\]? $/x ) {
$reason_dir_unusable =
'File::Spec->tmpdir returned a root directory instead of a designated '
. 'tempdir (possibly https://rt.cpan.org/Ticket/Display.html?id=76663)';
else {
# make sure we can actually create and sysopen a file in this dir
local $@;
+ my $u = local_umask(0); # match the umask we use in DBICTest(::Schema)
my $tempfile = '<NONCREATABLE>';
eval {
$tempfile = File::Temp->new(
} or do {
chomp( my $err = $@ );
my @x_tests = map { (defined $_) ? ( $_ ? 1 : 0 ) : 'U' } map {(-e, -d, -f, -r, -w, -x, -o)} ("$dir", "$tempfile");
- $reason_dir_unusable = sprintf <<"EOE", "$tempfile"||'', $err, scalar $>, scalar $), (stat($dir))[4,5,2], @x_tests;
+ $reason_dir_unusable = sprintf <<"EOE", "$tempfile"||'', $err, scalar $>, scalar $), umask(), (stat($dir))[4,5,2], @x_tests;
File::Spec->tmpdir returned a directory which appears to be non-writeable:
Error encountered while testing '%s': %s
Process EUID/EGID: %s / %s
+Effective umask: %o
TmpDir UID/GID: %s / %s
TmpDir StatMode: %o
TmpDir X-tests: -e:%s -d:%s -f:%s -r:%s -w:%s -x:%s -o:%s
}
sub is_smoker {
- return
- ( ($ENV{TRAVIS}||'') eq 'true' )
- ||
+ return (
( $ENV{AUTOMATED_TESTING} && ! $ENV{PERL5_CPANM_IS_RUNNING} && ! $ENV{RELEASE_TESTING} )
- ;
+ or
+ __PACKAGE__->is_ci
+ );
+}
+
+sub is_ci {
+ return (
+ ($ENV{TRAVIS}||'') eq 'true'
+ and
+ ($ENV{TRAVIS_REPO_SLUG}||'') =~ m|\w+/dbix-class$|
+ )
}
sub is_plain {
- return (! __PACKAGE__->is_smoker && ! __PACKAGE__->is_author && ! $ENV{RELEASE_TESTING} )
+ return (
+ ! $ENV{RELEASE_TESTING}
+ and
+ ! $ENV{DBICTEST_RUN_ALL_TESTS}
+ and
+ ! __PACKAGE__->is_smoker
+ and
+ ! __PACKAGE__->is_author
+ )
}
# Try to determine the root of a checkout/untar if possible