X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FRunMode.pm;h=604e71fba51ebd7cd2e5b4ba3800fe69a54ef088;hb=3ba92e4a5dad1de3f829a46bd375bb6cbaa987f1;hp=348c8ea757119a83d7028aa423e25c19adb8dd6d;hpb=f15baf68c83f99fd34d7ac6ba9c54fcdcdc7a7e8;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest/RunMode.pm b/t/lib/DBICTest/RunMode.pm index 348c8ea..604e71f 100644 --- a/t/lib/DBICTest/RunMode.pm +++ b/t/lib/DBICTest/RunMode.pm @@ -43,23 +43,23 @@ sub tmpdir { else { # make sure we can actually create and sysopen a file in this dir local $@; - my $tfh; + my $tempfile = ''; eval { - $tfh = File::Temp->new( - TEMPLATE => '_dbictest_writability_XXXXXX', + $tempfile = File::Temp->new( + TEMPLATE => '_dbictest_writability_test_XXXXXX', DIR => "$dir", UNLINK => 1, ); - my $fn = "$tfh"; - close $tfh or die "closing $fn failed: $!\n"; - sysopen (my $tfh2, $fn, O_RDWR) or die "reopening $fn failed: $!\n"; - print $tfh2 'deadbeef' x 1024 or die "printing to $fn failed: $!\n"; - close $tfh2 or die "closing $fn failed: $!\n"; + close $tempfile or die "closing $tempfile failed: $!\n"; + + sysopen (my $tempfh2, "$tempfile", O_RDWR) or die "reopening $tempfile failed: $!\n"; + print $tempfh2 'deadbeef' x 1024 or die "printing to $tempfile failed: $!\n"; + close $tempfh2 or die "closing $tempfile failed: $!\n"; 1; } or do { chomp( my $err = $@ ); - my @x_tests = map { (defined $_) ? ( $_ ? 1 : 0 ) : 'U' } map {(-e, -d, -f, -r, -w, -x, -o)} ("$dir", "$tfh"); - $reason_dir_unusable = sprintf <<"EOE", "$tfh"||'', $err, scalar $>, scalar $), (stat($dir))[4,5,2], @x_tests; + 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; File::Spec->tmpdir returned a directory which appears to be non-writeable: Error encountered while testing '%s': %s Process EUID/EGID: %s / %s