Subject: | PATCH to get tests to pass on VMS |
Ahoy! and thanks for DBI.
Please find attached a(n eye) patch against
http://svn.perl.org/modules/dbi/trunk
that gets DBI to pass it's tests on VMS.
Peter (Stig) Edwards
Subject: | vms.patch |
Index: trunk/lib/DBI/ProfileData.pm
===================================================================
--- trunk/lib/DBI/ProfileData.pm (revision 9950)
+++ trunk/lib/DBI/ProfileData.pm (working copy)
@@ -196,9 +196,15 @@
if ($self->{DeleteFiles}) {
my $newfilename = $filename . ".deleteme";
+ if($^O eq 'VMS'){
+ # VMS default filesystem can only have one period
+ $newfilename = $filename . 'deleteme';
+ }
# will clobber an existing $newfilename
rename($filename, $newfilename)
or croak "Can't rename($filename, $newfilename): $!";
+ # On a versioned filesystem we want old versions to be removed
+ 1 while (unlink $filename);
$filename = $newfilename;
}
@@ -219,7 +225,13 @@
push @files_to_delete, $filename
if $self->{DeleteFiles};
}
- unlink $_ or warn "Can't delete '$_': $!" for @files_to_delete;
+ for (@files_to_delete){
+ # for versioned file systems
+ 1 while (unlink $_);
+ if(-e $_){
+ warn "Can't delete '$_': $!";
+ }
+ }
# discard node_lookup now that all files are read
delete $self->{_node_lookup};
Index: trunk/t/85gofer.t
===================================================================
--- trunk/t/85gofer.t (revision 9950)
+++ trunk/t/85gofer.t (working copy)
@@ -80,7 +80,7 @@
or next;
# XXX temporary restrictions, hopefully
- if ($^O eq 'MSWin32') {
+ if ( ($^O eq 'MSWin32') || ($^O eq 'VMS') ) {
# 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';
Index: trunk/t/19fhtrace.t
===================================================================
--- trunk/t/19fhtrace.t (revision 9950)
+++ trunk/t/19fhtrace.t (working copy)
@@ -188,7 +188,10 @@
# read new file size and verify its different
#
my $newfsz = (stat $tracefd)[7];
-ok(($filesz != $newfsz), '... regular fh: trace_msg');
+SKIP: {
+ skip 'on VMS autoflush using select does not work', 1 unless ($^O ne 'VMS');
+ ok(($filesz != $newfsz), '... regular fh: trace_msg');
+}
$dbh->trace(undef, "STDOUT"); # close $trace_file
ok(-f $trace_file, '... regular fh: file successfully changed');
Index: trunk/t/50dbm.t
===================================================================
--- trunk/t/50dbm.t (revision 9950)
+++ trunk/t/50dbm.t (working copy)
@@ -3,6 +3,7 @@
use strict;
use File::Path;
+use File::Spec;
use Test::More;
use Cwd;
use Config qw(%Config);
@@ -64,7 +65,7 @@
}
}
-my $dir = getcwd().'/test_output';
+my $dir = File::Spec->catdir(getcwd(),'test_output');
rmtree $dir;
mkpath $dir;