This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tests using t/lib/common.pl need to run in separate directories.
authorNicholas Clark <nick@ccl4.org>
Wed, 1 Sep 2010 18:05:52 +0000 (19:05 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 1 Sep 2010 18:10:14 +0000 (19:10 +0100)
Commit 8f776eae73090661 turned out to be a bit optimistic with
"should be capable of running in parallel", as the temporary files and
modules written out by the various test scripts have clashing names.
Hence run each test a private subdirectory.

lib/charnames.t
t/lib/charnames/alias
t/lib/common.pl
t/lib/warnings/doio
t/lib/warnings/pp_sys

index 74b0999..eb7358c 100644 (file)
@@ -810,8 +810,8 @@ is("\N{U+1D0C5}", "\N{BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS}");
     my @algorithmic_names_count = (0) x $block_count;
 
     # Read the DB, and fill in @names with the character names.
-    open my $fh, "<", "../lib/unicore/UnicodeData.txt" or
-        die "Can't open ../lib/unicore/UnicodeData.txt: $!";
+    open my $fh, "<", "../../lib/unicore/UnicodeData.txt" or
+        die "Can't open ../../lib/unicore/UnicodeData.txt: $!";
     while (<$fh>) {
         chomp;
         my ($code, $name, undef, undef, undef, undef, undef, undef, undef, undef, $u1name) = split ";";
index 56b294e..eba6d1b 100644 (file)
@@ -189,7 +189,7 @@ OPTIONS regex
 unicore/perl_alias.pl cannot be used as alias file for charnames at
 ########
 # alias with bad file
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 0;
 --FILE--
@@ -202,7 +202,7 @@ OPTIONS regex
 unicore/xyzzy_alias.pl did not return a \(valid\) list of alias pairs at
 ########
 # alias with file with empty list
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 ();
 --FILE--
@@ -215,7 +215,7 @@ OPTIONS regex
 Unknown charname 'e_ACUTE' at
 ########
 # alias with file OK but file has :short aliasses
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 (   e_ACUTE => "LATIN:e WITH ACUTE",
     a_ACUTE => "LATIN:a WITH ACUTE",
@@ -230,7 +230,7 @@ OPTIONS regex
 Unknown charname 'LATIN:e WITH ACUTE' at
 ########
 # alias with :short and file OK
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 (   e_ACUTE => "LATIN:e WITH ACUTE",
     a_ACUTE => "LATIN:a WITH ACUTE",
@@ -245,7 +245,7 @@ OPTIONS regex
 $
 ########
 # alias with :short and file OK has :long aliasses
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 (   e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
     a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
@@ -260,7 +260,7 @@ OPTIONS regex
 Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
 ########
 # alias with file implicit :full but file has :short aliasses
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 (   e_ACUTE => "LATIN:e WITH ACUTE",
     a_ACUTE => "LATIN:a WITH ACUTE",
@@ -275,7 +275,7 @@ OPTIONS regex
 Unknown charname 'LATIN:e WITH ACUTE' at
 ########
 # alias with file implicit :full and file has :long aliasses
---FILE-- ../lib/unicore/xyzzy_alias.pl
+--FILE-- ../../lib/unicore/xyzzy_alias.pl
 #!perl
 (   e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
     a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
index e68a351..7c98b13 100644 (file)
@@ -55,6 +55,21 @@ foreach my $file (@w_files) {
     close F ;
 }
 
+my $tempdir = tempfile;
+
+mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
+chdir $tempdir or die die "Can't chdir '$tempdir': $!";
+unshift @INC, '../../lib';
+my $cleanup = 1;
+my %tempfiles;
+
+END {
+    if ($cleanup) {
+       chdir '..' or die "Couldn't chdir .. for cleanup: $!";
+       rmtree($tempdir);
+    }
+}
+
 local $/ = undef;
 
 my $tests = $::local_tests || 0;
@@ -121,7 +136,8 @@ for (@prgs){
     print TEST "\n#line 1\n";  # So the line numbers don't get messed up.
     print TEST $prog,"\n";
     close TEST or die "Cannot close $tmpfile: $!";
-    my $results = runperl( switches => [$switch], stderr => 1, progfile => $tmpfile );
+    my $results = runperl( switches => ["-I../../lib", $switch], nolib => 1,
+                          stderr => 1, progfile => $tmpfile );
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
index 970f33a..815e8a2 100644 (file)
@@ -262,9 +262,9 @@ EOM
 }
 use warnings 'io' ;
 close STDOUT;
-open FH1, "harness"; close FH1;
+open FH1, "../harness"; close FH1;
 no warnings 'io' ;
-open FH2, "harness"; close FH2;
+open FH2, "../harness"; close FH2;
 EXPECT
 Filehandle STDOUT reopened as FH1 only for input at - line 14.
 ########
index 2e9c613..8c61397 100644 (file)
@@ -422,7 +422,7 @@ binmode() on unopened filehandle at - line 4.
 ########
 # pp_sys.c [pp_lstat]
 use warnings 'io';
-open FH, "harness" or die "# $!";
+open FH, "../harness" or die "# $!";
 lstat FH;
 open my $fh, $0 or die "# $!";
 lstat $fh;
@@ -499,19 +499,19 @@ chdir() on closed filehandle $fh at - line 23.
 use warnings;
 opendir FOO, ".";
 opendir my $foo, ".";
-open FOO, "TEST";
-open $foo, "TEST";
+open FOO, "../harness";
+open $foo, "../harness";
 no warnings qw(io deprecated);
-open FOO, "TEST";
-open $foo, "TEST";
+open FOO, "../harness";
+open $foo, "../harness";
 EXPECT
 Opening dirhandle FOO also as a file at - line 5.
 Opening dirhandle $foo also as a file at - line 6.
 ########
 # pp_sys.c [pp_open_dir]
 use warnings;
-open FOO, "TEST";
-open my $foo, "TEST";
+open FOO, "../harness";
+open my $foo, "../harness";
 opendir FOO, ".";
 opendir $foo, ".";
 no warnings qw(io deprecated);