Author: timbo
Date: Tue Feb 20 17:32:59 2007
New Revision: 9148
Modified:
dbi/trunk/lib/DBI/PurePerl.pm
dbi/trunk/t/10examp.t
dbi/trunk/t/85gofer.t
Log:
Attempt to fix t/zvp_10examp.t failures related to closing trace files.
Cut my losses with t/85gofer.t by disabling both pipeone and stream on windows.
Modified: dbi/trunk/lib/DBI/PurePerl.pm
==============================================================================
--- dbi/trunk/lib/DBI/PurePerl.pm (original)
+++ dbi/trunk/lib/DBI/PurePerl.pm Tue Feb 20 17:32:59 2007
@@ -515,42 +515,29 @@
sub _set_trace_file {
my ($file) = @_;
- return unless defined $file;
#
# DAA add support for filehandle inputs
#
- if (ref $file eq 'GLOB') {
# DAA required to avoid closing a prior fh trace()
- $DBI::tfh = undef
- unless $DBI::tfh_needs_close;
+ $DBI::tfh = undef unless $DBI::tfh_needs_close;
+
+ if (ref $file eq 'GLOB') {
$DBI::tfh = $file;
- select((select($DBI::tfh), $| = 1)[0]);
- $DBI::tfh_needs_close = 0;
- return 1;
+ select((select($DBI::tfh), $| = 1)[0]);
+ $DBI::tfh_needs_close = 0;
+ return 1;
}
- if (!$file || $file eq 'STDERR') {
- # DAA required to avoid closing a prior fh trace()
- $DBI::tfh = undef
- unless $DBI::tfh_needs_close;
- open $DBI::tfh, ">&STDERR" or warn "Can't dup STDERR: $!";
$DBI::tfh_needs_close = 1;
- return 1;
+ if (!$file || $file eq 'STDERR') {
+ open $DBI::tfh, ">&STDERR" or carp "Can't dup STDERR: $!";
}
- if ($file eq 'STDOUT') {
- # DAA required to avoid closing a prior fh trace()
- $DBI::tfh = undef
- unless $DBI::tfh_needs_close;
- open $DBI::tfh, ">&STDOUT" or warn "Can't dup STDOUT: $!";
- $DBI::tfh_needs_close = 1;
- return 1;
+ elsif ($file eq 'STDOUT') {
+ open $DBI::tfh, ">&STDOUT" or carp "Can't dup STDOUT: $!";
+ }
+ else {
+ open $DBI::tfh, ">>$file" or carp "Can't open $file: $!";
}
- # DAA required to avoid closing a prior fh trace()
- # DAA required to avoid closing a prior fh trace()
- $DBI::tfh = undef
- unless $DBI::tfh_needs_close;
- open $DBI::tfh, ">>$file" or carp "Can't open $file: $!";
select((select($DBI::tfh), $| = 1)[0]);
- $DBI::tfh_needs_close = 1;
return 1;
}
sub _get_imp_data { shift->{"imp_data"}; }
Modified: dbi/trunk/t/10examp.t
==============================================================================
--- dbi/trunk/t/10examp.t (original)
+++ dbi/trunk/t/10examp.t Tue Feb 20 17:32:59 2007
@@ -12,7 +12,7 @@
my $haveFileSpec = eval { require File::Spec };
require VMS::Filespec if $^O eq 'VMS';
-use Test::More tests => 206;
+use Test::More tests => 204;
# "globals"
my ($r, $dbh);
@@ -22,12 +22,10 @@
my $trace_file = "dbitrace.log";
- SKIP: {
- skip "no trace file to clean up", 2 unless (-e $trace_file);
-
- is(unlink( $trace_file ), 1, "Remove trace file: $trace_file" );
- ok( !-e $trace_file, "Trace file actually gone" );
- }
+ if (-e $trace_file) {
+ 1 while unlink $trace_file;
+ die "Can't unlink existing $trace_file: $!" if -e $trace_file;
+ }
my $orig_trace_level = DBI->trace;
DBI->trace(3, $trace_file); # enable trace before first
driver load
Modified: dbi/trunk/t/85gofer.t
==============================================================================
--- dbi/trunk/t/85gofer.t (original)
+++ dbi/trunk/t/85gofer.t Tue Feb 20 17:32:59 2007
@@ -68,8 +68,12 @@
my $trans_attr = $trials{$trial}
or next;
- # XXX temporary restriction, hopefully
- next if $transport eq 'stream' and $^O eq 'MSWin32'; # need Fcntl macro
F_GETFL for non-blocking
+ # XXX temporary restrictions, hopefully
+ if ($^O eq 'MSWin32') {
+ # stream needs Fcntl macro F_GETFL for non-blocking
+ # and pipe seems to hang on some windows systems
+ next if $transport eq 'stream' or $transport eq 'pipeone';
+ }
for my $policy_name (qw(pedantic classic rush)) {