summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-09-01 19:05:52 +0100
committerNicholas Clark <nick@ccl4.org>2010-09-01 19:10:14 +0100
commit463cf0628d7a451d99106f7101151d3a9b97fcbf (patch)
treec99ed9d43aa4e2cf5b13d8ec980ca985b4dc3674 /t/lib
parent4c3ca3f48a3e5f7633cf0ffcb5ac673bdbcf7f45 (diff)
downloadperl-463cf0628d7a451d99106f7101151d3a9b97fcbf.tar.gz
Tests using t/lib/common.pl need to run in separate directories.
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.
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/charnames/alias14
-rw-r--r--t/lib/common.pl18
-rw-r--r--t/lib/warnings/doio4
-rw-r--r--t/lib/warnings/pp_sys14
4 files changed, 33 insertions, 17 deletions
diff --git a/t/lib/charnames/alias b/t/lib/charnames/alias
index 56b294edba..eba6d1b412 100644
--- a/t/lib/charnames/alias
+++ b/t/lib/charnames/alias
@@ -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",
diff --git a/t/lib/common.pl b/t/lib/common.pl
index e68a3519ba..7c98b13c70 100644
--- a/t/lib/common.pl
+++ b/t/lib/common.pl
@@ -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
diff --git a/t/lib/warnings/doio b/t/lib/warnings/doio
index 970f33ad51..815e8a2f0c 100644
--- a/t/lib/warnings/doio
+++ b/t/lib/warnings/doio
@@ -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.
########
diff --git a/t/lib/warnings/pp_sys b/t/lib/warnings/pp_sys
index 2e9c613b02..8c61397d6f 100644
--- a/t/lib/warnings/pp_sys
+++ b/t/lib/warnings/pp_sys
@@ -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);