In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/55d965ca4f960e5184aee9d61160d29af04301f1?hp=1b40bf739e6ca5afa221cbd023637688b5c254a5>

- Log -----------------------------------------------------------------
commit 55d965ca4f960e5184aee9d61160d29af04301f1
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 15:12:15 2009 +0100

    Run tests in ext/ and dist/ with relative paths for perl and @INC.
    
    Also, as only tests in cpan/ are using %no_abs and %temp_no_core, only 
consult
    these look-up hashes for tests in cpan/

M       t/TEST

commit e2ed8602764fab16dbe10b42e3a8bbfe202b8392
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 15:11:06 2009 +0100

    Swap the chdir and the call to perl_lib(), to work with relative paths in 
@INC.

M       dist/ExtUtils-Install/t/InstallWithMM.t

commit fc5e5837c991d3d3224259ff5c1d728d4e0636e2
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 15:05:58 2009 +0100

    MakeMaker::Test::Utils::perl_lib now copes with relative paths for core 
testing.
    
    In the core, @INC already contains the moral equivalent of blib/lib. 
However,
    it's a relative path (by default), so make it absolute. It's easier to KISS 
if
    this is done *before* any change of directory, so document this, and change 
the
    non-core case to add the absolute path of 'blib/lib' to @INC, rather than 
the
    absolute path of '../blib/lib'.

M       dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm

commit 794ae82d17ef6f7770c42b070af5c40bc4bf19cb
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 14:09:02 2009 +0100

    Remove core @INC setting and chdir boilerplate from Thread::Semaphore's 
tests.

M       dist/Thread-Semaphore/t/01_basic.t
M       dist/Thread-Semaphore/t/02_errs.t
M       dist/Thread-Semaphore/t/03_nothreads.t

commit d9d68dec8f4679ec61ddeb6bf83d123cec91a9f7
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 14:07:03 2009 +0100

    Remove core @INC setting and chdir boilerplate from Thread::Queue's tests.

M       dist/Thread-Queue/t/01_basic.t
M       dist/Thread-Queue/t/02_refs.t
M       dist/Thread-Queue/t/03_peek.t
M       dist/Thread-Queue/t/04_errs.t
M       dist/Thread-Queue/t/05_extract.t
M       dist/Thread-Queue/t/06_insert.t
M       dist/Thread-Queue/t/07_lock.t
M       dist/Thread-Queue/t/08_nothreads.t

commit 6af60d5fdae744e61d3a0d95ecbaf1c098867f14
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 14:06:22 2009 +0100

    Remove core @INC setting and chdir boilerplate from SelfLoader's tests.

M       dist/SelfLoader/t/01SelfLoader.t
M       dist/SelfLoader/t/02SelfLoader-buggy.t

commit 7a382f6efaecaa2a4f1b8ce56e7e2af5841bb366
Author: Nicholas Clark <[email protected]>
Date:   Sun Oct 11 14:05:13 2009 +0100

    Remove core @INC setting boilerplate from lib's test.

M       dist/lib/t/01lib.t
-----------------------------------------------------------------------

Summary of changes:
 dist/ExtUtils-Install/t/InstallWithMM.t            |    4 +-
 .../ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm |   27 +++++++++++++------
 dist/SelfLoader/t/01SelfLoader.t                   |    2 -
 dist/SelfLoader/t/02SelfLoader-buggy.t             |    7 -----
 dist/Thread-Queue/t/01_basic.t                     |    4 ---
 dist/Thread-Queue/t/02_refs.t                      |    4 ---
 dist/Thread-Queue/t/03_peek.t                      |    4 ---
 dist/Thread-Queue/t/04_errs.t                      |    7 -----
 dist/Thread-Queue/t/05_extract.t                   |    4 ---
 dist/Thread-Queue/t/06_insert.t                    |    4 ---
 dist/Thread-Queue/t/07_lock.t                      |    4 ---
 dist/Thread-Queue/t/08_nothreads.t                 |    7 -----
 dist/Thread-Semaphore/t/01_basic.t                 |    4 ---
 dist/Thread-Semaphore/t/02_errs.t                  |    7 -----
 dist/Thread-Semaphore/t/03_nothreads.t             |    7 -----
 dist/lib/t/01lib.t                                 |    3 --
 t/TEST                                             |   14 ++++++----
 17 files changed, 28 insertions(+), 85 deletions(-)

diff --git a/dist/ExtUtils-Install/t/InstallWithMM.t 
b/dist/ExtUtils-Install/t/InstallWithMM.t
index 028c01a..4b2c439 100644
--- a/dist/ExtUtils-Install/t/InstallWithMM.t
+++ b/dist/ExtUtils-Install/t/InstallWithMM.t
@@ -27,10 +27,10 @@ delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
     my $perl = which_perl();
     my $Is_VMS = $^O eq 'VMS';
 
-    chdir 't';
-
     perl_lib;
 
+    chdir 't';
+
     my $Touch_Time = calibrate_mtime();
 
     $| = 1;
diff --git a/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm 
b/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
index 7e5d5fc..907ca9b 100644
--- a/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
+++ b/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
@@ -135,21 +135,30 @@ sub which_perl {
   perl_lib;
 
 Sets up environment variables so perl can find its libraries.
+Run this before changing directories.
 
 =cut
 
 my $old5lib = $ENV{PERL5LIB};
 my $had5lib = exists $ENV{PERL5LIB};
 sub perl_lib {
-                               # perl-src/t/
-    my $lib =  $ENV{PERL_CORE} ? qq{../lib}
-                               # ExtUtils-MakeMaker/t/
-                               : qq{../blib/lib};
-    $lib = File::Spec->rel2abs($lib);
-    my @libs = ($lib);
-    push @libs, $ENV{PERL5LIB} if exists $ENV{PERL5LIB};
-    $ENV{PERL5LIB} = join($Config{path_sep}, @libs);
-    unshift @INC, $lib;
+    if ($ENV{PERL_CORE}) {
+       # Whilst we'll be running in perl-src/cpan/$distname/t/
+       # instead of blib, our code will be copied with all the other code to
+       # the top-level library.
+       # $ENV{PERL5LIB} will be set with this, but (by default) it's a relative
+       # path.
+       $ENV{PERL5LIB} = join $Config{path_sep}, map {
+           File::Spec->rel2abs($_) } split $Config{path_sep}, $ENV{PERL5LIB};
+       @INC = map { File::Spec->rel2abs($_) } @INC;
+    } else {
+       my $lib = 'blib/lib';
+       $lib = File::Spec->rel2abs($lib);
+       my @libs = ($lib);
+       push @libs, $ENV{PERL5LIB} if exists $ENV{PERL5LIB};
+       $ENV{PERL5LIB} = join($Config{path_sep}, @libs);
+       unshift @INC, $lib;
+    }
 }
 
 END { 
diff --git a/dist/SelfLoader/t/01SelfLoader.t b/dist/SelfLoader/t/01SelfLoader.t
index 68c1229..2471076 100644
--- a/dist/SelfLoader/t/01SelfLoader.t
+++ b/dist/SelfLoader/t/01SelfLoader.t
@@ -1,5 +1,4 @@
 BEGIN {
-    chdir 't' if -d 't';
     $dir = "self-$$";
     $sep = "/";
 
@@ -9,7 +8,6 @@ BEGIN {
     }
 
     unshift @INC, $dir;
-    unshift @INC, '../lib';
 
     print "1..20\n";
 
diff --git a/dist/SelfLoader/t/02SelfLoader-buggy.t 
b/dist/SelfLoader/t/02SelfLoader-buggy.t
index 7845d05..fd565f9 100644
--- a/dist/SelfLoader/t/02SelfLoader-buggy.t
+++ b/dist/SelfLoader/t/02SelfLoader-buggy.t
@@ -1,10 +1,3 @@
-BEGIN {
-    if( $ENV{PERL_CORE} ) {
-        chdir 't' if -d 't';
-        @INC = '../lib';
-    }
-}
-
 use SelfLoader;
 print "1..1\n";
 
diff --git a/dist/Thread-Queue/t/01_basic.t b/dist/Thread-Queue/t/01_basic.t
index 6a0d838..2983f0b 100644
--- a/dist/Thread-Queue/t/01_basic.t
+++ b/dist/Thread-Queue/t/01_basic.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/02_refs.t b/dist/Thread-Queue/t/02_refs.t
index 3a59b5e..0cebdc1 100644
--- a/dist/Thread-Queue/t/02_refs.t
+++ b/dist/Thread-Queue/t/02_refs.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/03_peek.t b/dist/Thread-Queue/t/03_peek.t
index 1844c06..d543b59 100644
--- a/dist/Thread-Queue/t/03_peek.t
+++ b/dist/Thread-Queue/t/03_peek.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/04_errs.t b/dist/Thread-Queue/t/04_errs.t
index 3479c83..da8f979 100644
--- a/dist/Thread-Queue/t/04_errs.t
+++ b/dist/Thread-Queue/t/04_errs.t
@@ -1,13 +1,6 @@
 use strict;
 use warnings;
 
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
-
 use Thread::Queue;
 
 use Test::More 'tests' => 26;
diff --git a/dist/Thread-Queue/t/05_extract.t b/dist/Thread-Queue/t/05_extract.t
index 2773340..de0e78b 100644
--- a/dist/Thread-Queue/t/05_extract.t
+++ b/dist/Thread-Queue/t/05_extract.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/06_insert.t b/dist/Thread-Queue/t/06_insert.t
index 4f9c2b4..4f9d1df 100644
--- a/dist/Thread-Queue/t/06_insert.t
+++ b/dist/Thread-Queue/t/06_insert.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/07_lock.t b/dist/Thread-Queue/t/07_lock.t
index 625159e..f9e258e 100644
--- a/dist/Thread-Queue/t/07_lock.t
+++ b/dist/Thread-Queue/t/07_lock.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Queue/t/08_nothreads.t 
b/dist/Thread-Queue/t/08_nothreads.t
index 7ac4348..006b275 100644
--- a/dist/Thread-Queue/t/08_nothreads.t
+++ b/dist/Thread-Queue/t/08_nothreads.t
@@ -1,13 +1,6 @@
 use strict;
 use warnings;
 
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
-
 use Test::More 'tests' => 32;
 
 use Thread::Queue;
diff --git a/dist/Thread-Semaphore/t/01_basic.t 
b/dist/Thread-Semaphore/t/01_basic.t
index 06fc2b2..c5670bd 100644
--- a/dist/Thread-Semaphore/t/01_basic.t
+++ b/dist/Thread-Semaphore/t/01_basic.t
@@ -2,10 +2,6 @@ use strict;
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
diff --git a/dist/Thread-Semaphore/t/02_errs.t 
b/dist/Thread-Semaphore/t/02_errs.t
index 06f0b93..45b0aa9 100644
--- a/dist/Thread-Semaphore/t/02_errs.t
+++ b/dist/Thread-Semaphore/t/02_errs.t
@@ -1,13 +1,6 @@
 use strict;
 use warnings;
 
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
-
 use Thread::Semaphore;
 
 use Test::More 'tests' => 12;
diff --git a/dist/Thread-Semaphore/t/03_nothreads.t 
b/dist/Thread-Semaphore/t/03_nothreads.t
index 58bcb04..f0454be 100644
--- a/dist/Thread-Semaphore/t/03_nothreads.t
+++ b/dist/Thread-Semaphore/t/03_nothreads.t
@@ -1,13 +1,6 @@
 use strict;
 use warnings;
 
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
-
 use Test::More 'tests' => 4;
 
 use Thread::Semaphore;
diff --git a/dist/lib/t/01lib.t b/dist/lib/t/01lib.t
index d39a656..f58fce5 100644
--- a/dist/lib/t/01lib.t
+++ b/dist/lib/t/01lib.t
@@ -1,9 +1,6 @@
 #!./perl -w
 
 BEGIN {
-    chdir 't';
-    unshift @INC, '..';
-    unshift @INC, '../lib';
     @OrigINC = @INC;
 }
 
diff --git a/t/TEST b/t/TEST
index 56441a2..096417a 100755
--- a/t/TEST
+++ b/t/TEST
@@ -193,17 +193,19 @@ sub _scan_test {
     my $dir = $1;
     my $testswitch = $dir_to_switch{$dir};
     if (!defined $testswitch) {
-       if ($test =~ s!^(\.\./(?:cpan|dist|ext)/[^/]+)/t!t!) {
+       if ($test =~ s!^(\.\./(cpan|dist|ext)/[^/]+)/t!t!) {
            $run_dir = $1;
            $return_dir = '../../t';
            $lib = '../../lib';
            $perl = '../../t/perl';
            $testswitch = "-I../.. -MTestInit=U2T";
-           if (!$no_abs{$run_dir}) {
-               $testswitch = $testswitch . ',A';
-           }
-           if ($temp_no_core{$run_dir}) {
-               $testswitch = $testswitch . ',NC';
+           if ($2 eq 'cpan') {
+               if(!$no_abs{$run_dir}) {
+                   $testswitch = $testswitch . ',A';
+               }
+               if ($temp_no_core{$run_dir}) {
+                   $testswitch = $testswitch . ',NC';
+               }
            }
        } else {
            $testswitch = '-I.. -MTestInit';  # -T will remove . from @INC

--
Perl5 Master Repository

Reply via email to