[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] Fix parallel testing temp filenames



'make test' on blead today gave me the following failure:

lib/charnames.................................................Could not open
tmp0001: Permission denied at ../lib/charnames.t line 289, <DATA> line 1.

It seems that lib/charnames.t, lib/strict.t and lib/subs.t
try to use temp files with names starting at 'tmp0000'.  The
above error would seem to have occurred with a collision
during parallel testing.

The attached patch fixes this by having these files
'require ./test.pl' and then using its new tempfile() function.
--- perl-current/lib/charnames.t
+++ perl-current/lib/charnames.t
@@ -271,10 +271,9 @@
 
 # ---- Alias extensions
 
-my $tmpfile = "tmp0000";
+my $tmpfile = tempfile();
 my $alifile = File::Spec->catfile(File::Spec->updir, qw(lib unicore xyzzy_alias.pl));
 my $i = 0;
-1 while -e ++$tmpfile;
 END { if ($tmpfile) { 1 while unlink $tmpfile; } }
 
 my @prgs;

--- perl-current/lib/strict.t
+++ perl-current/lib/strict.t
@@ -4,6 +4,7 @@
     chdir 't' if -d 't';
     @INC = '../lib';
     $ENV{PERL5LIB} = '../lib';
+    require './test.pl';
 }
 
 $| = 1;
@@ -11,9 +12,8 @@
 my $Is_VMS = $^O eq 'VMS';
 my $Is_MSWin32 = $^O eq 'MSWin32';
 my $Is_NetWare = $^O eq 'NetWare';
-my $tmpfile = "tmp0000";
+my $tmpfile = tempfile();
 my $i = 0 ;
-1 while -e ++$tmpfile;
 END { if ($tmpfile) { 1 while unlink $tmpfile; } }
 
 my @prgs = () ;
@@ -78,7 +78,7 @@
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
-    $results =~ s/tmp\d+/-/g;
+    $results =~ s/tmp\d+[A-Z][A-Z]?/-/g;
     $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS;  # clip off DCL status msg
     $expected =~ s/\n+$//;
     $expected =~ s|(\./)?abc\.pm|:abc.pm|g if $^O eq 'MacOS';

--- perl-current/lib/subs.t
+++ perl-current/lib/subs.t
@@ -4,6 +4,7 @@
     chdir 't' if -d 't';
     @INC = '../lib';
     $ENV{PERL5LIB} = '../lib';
+    require './test.pl';
 }
 
 $| = 1;
@@ -15,9 +16,8 @@
 my $Is_MSWin32 = $^O eq 'MSWin32';
 my $Is_NetWare = $^O eq 'NetWare';
 my $Is_MacOS = $^O eq 'MacOS';
-my $tmpfile = "tmp0000";
+my $tmpfile = tempfile();
 my $i = 0 ;
-1 while -e ++$tmpfile;
 END {  if ($tmpfile) { 1 while unlink $tmpfile} }
 
 for (@prgs){
@@ -59,7 +59,7 @@
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
-    $results =~ s/tmp\d+/-/g;
+    $results =~ s/tmp\d+[A-Z][A-Z]?/-/g;
     $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS;  # clip off DCL status msg
 # bison says 'parse error' instead of 'syntax error',
 # various yaccs may or may not capitalize 'syntax'.

Follow-Ups from:
Nicholas Clark <nick@ccl4.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]