develooper Front page | perl.perl5.porters | Postings from July 2003

[PATCH: 5.8.1 RC2] Encode test fixes for VMS (was Re: possible fix to File::Find problems)

Thread Next
From:
PPrymmer
Date:
July 21, 2003 08:55
Subject:
[PATCH: 5.8.1 RC2] Encode test fixes for VMS (was Re: possible fix to File::Find problems)
Message ID:
OF8922A46B.9A98E584-ON85256D6A.0056845F-85256D6A.00576965@factset.com





In a conversation from the vmsperl mailing list Craig Berry wrote
in reply to me:

!>ext/Encode/t/enc_eucjp...............FAILED at test 1
!>ext/Encode/t/enc_utf8................FAILED at test 1
!
!Dunno what's going on there.

It is a temporary file name issue with those tests.  The tests use file
names
like qw(f0 f1 f2) etc. I unfortunately have a rooted logical name F0 that
points
to a protected directory and the C<open(FILE, "<f0")> type statements in
those
tests fails.  I have a patch (enclosed and attached) that addresses the
test failures that I see by adding periods to the file names on VMS (We
might consider: C<use File::Temp;>? Also, shouldn't File::Temp return
a file name with a period appended on VMS?  The enclosed patch does not
implement either idea though.)   While in there I noted a large number of
perlio.$$PID files in the [.ext.encode.t] directory so I added some of
the standard VMS temp file cleanup to the perlio.t test in this patch as
well
(the perlio.t test had not been failing for me).

Files affected:

ext/Encode/t/enc_eucjp.t
ext/Encode/t/enc_utf8.t
ext/Encode/t/perlio.t

Here is the patch taken against 5.8.1-RC2:

diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/enc_eucjp.t perl-5.8.1-RC2/ext/Encode/t/enc_eucjp.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/enc_eucjp.t      2003-07-10 02:10:44.000000000 -0400
+++ perl-5.8.1-RC2/ext/Encode/t/enc_eucjp.t     2003-07-21 11:41:51.922003000 -0400
@@ -31,8 +31,14 @@

 for my $i (0..$#c) {
   no warnings 'pack';
-  push @f, "f$i";
-  open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+  if ( $^O eq 'VMS' ) {
+      push @f, "f$i.";
+      open(F, ">f$i.") or die "$0: failed to open 'f$i.' for writing: $!";
+  }
+  else {
+      push @f, "f$i";
+      open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+  }
   binmode(F, ":utf8");
   print F chr($c[$i]);
   print F pack("C" => $c[$i]);
@@ -42,7 +48,12 @@
 my $t = 1;

 for my $i (0..$#c) {
-  open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+  if ( $^O eq 'VMS' ) {
+      open(F, "<f$i.") or die "$0: failed to open 'f$i.' for reading: $!";
+  }
+  else {
+      open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+  }
   binmode(F, ":utf8");
   my $c = <F>;
   my $o = ord($c);
@@ -52,12 +63,23 @@

 my $f = "f" . @f;

-push @f, $f;
-open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
+if ( $^O eq 'VMS' ) {
+    push @f, "$f.";
+    open(F, ">$f.") or die "$0: failed to open '$f.' for writing: $!";
+}
+else {
+    push @f, $f;
+    open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
+}
 binmode(F, ":raw"); # Output raw bytes.
 print F chr(128); # Output illegal UTF-8.
 close F;
-open(F, $f) or die "$0: failed to open '$f' for reading: $!";
+if ( $^O eq 'VMS' ) {
+    open(F, "$f.") or die "$0: failed to open '$f.' for reading: $!";
+}
+else {
+    open(F, $f) or die "$0: failed to open '$f' for reading: $!";
+}
 binmode(F, ":encoding(utf-8)");
 {
      local $^W = 1;
diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/enc_utf8.t perl-5.8.1-RC2/ext/Encode/t/enc_utf8.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/enc_utf8.t 2003-07-10 02:10:44.000000000 -0400
+++ perl-5.8.1-RC2/ext/Encode/t/enc_utf8.t      2003-07-21 11:41:42.272003000 -0400
@@ -26,8 +26,14 @@
 my @f;

 for my $i (0..$#c) {
-  push @f, "f$i";
-  open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+  if ( $^O eq 'VMS' ) {
+      push @f, "f$i.";
+      open(F, ">f$i.") or die "$0: failed to open 'f$i.' for writing: $!";
+  }
+  else {
+      push @f, "f$i";
+      open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+  }
   binmode(F, ":utf8");
   print F chr($c[$i]);
   close F;
@@ -36,7 +42,12 @@
 my $t = 1;

 for my $i (0..$#c) {
-  open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+  if ( $^O eq 'VMS' ) {
+      open(F, "<f$i.") or die "$0: failed to open 'f$i.' for reading: $!";
+  }
+  else {
+      open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+  }
   binmode(F, ":utf8");
   my $c = <F>;
   my $o = ord($c);
@@ -46,12 +57,23 @@

 my $f = "f" . @f;

-push @f, $f;
-open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
+if ( $^O eq 'VMS' ) {
+    push @f, "$f.";
+    open(F, ">$f.") or die "$0: failed to open '$f.' for writing: $!";
+}
+else {
+    push @f, $f;
+    open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
+}
 binmode(F, ":raw"); # Output raw bytes.
 print F chr(128); # Output illegal UTF-8.
 close F;
-open(F, $f) or die "$0: failed to open '$f' for reading: $!";
+if ( $^O eq 'VMS' ) {
+    open(F, "$f.") or die "$0: failed to open '$f.' for reading: $!";
+}
+else {
+    open(F, $f) or die "$0: failed to open '$f' for reading: $!";
+}
 binmode(F, ":encoding(utf-8)");
 {
      local $^W = 1;
diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/perlio.t perl-5.8.1-RC2/ext/Encode/t/perlio.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/perlio.t   2003-07-10 02:10:45.000000000 -0400
+++ perl-5.8.1-RC2/ext/Encode/t/perlio.t  2003-07-21 11:43:06.418003000 -0400
@@ -122,7 +122,10 @@
            dump2file("$pfile.$seq", $dtext);
          }
      }
-     $DEBUG or unlink ($sfile, $pfile);
+     if ( ! $DEBUG ) {
+            1 while unlink ($sfile);
+            1 while unlink ($pfile);
+        }
     }
 }
 End of Patch.

And here it is as an attachment (that will hopefully not suffer
weird line breakage):

(See attached file: encode_tests.patch)

I hope that helps.

Peter Prymmer

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About