Integrate mainline
[p5sagit/p5-mst-13.2.git] / t / TEST
diff --git a/t/TEST b/t/TEST
index 148e9bd..e455043 100755 (executable)
--- a/t/TEST
+++ b/t/TEST
@@ -9,6 +9,7 @@ $| = 1;
 if ($#ARGV >= 0) {
     foreach my $idx (0..$#ARGV) {
        next unless $ARGV[$idx] =~ /^-(\S+)$/;
+       $core    = 1 if $1 eq 'core';
        $verbose = 1 if $1 eq 'v';
        $with_utf= 1 if $1 eq 'utf8';
        if ($1 =~ /^deparse(,.+)?$/) {
@@ -64,20 +65,26 @@ sub _find_tests {
 }
 
 unless (@ARGV) {
-    foreach my $dir (qw(base comp cmd run io op pragma lib pod)) {
+    foreach my $dir (qw(base comp cmd run io op)) {
         _find_tests($dir);
     }
+    _find_tests("lib") unless $core;
     my $mani = File::Spec->catdir($updir, "MANIFEST");
     if (open(MANI, $mani)) {
-        while (<MANI>) {
-           if (m!^((?:ext|lib)/.+/(?:t/.+\.t)|test.pl)\s!) {
-               push @ARGV, $1;
-               $OVER{$1} = File::Spec->catdir($updir, $1);
+        while (<MANI>) { # similar code in t/harness
+           if (m!^(ext/\S+/([^/]+\.t|test\.pl)|lib/\S+?(\.t|test\.pl))\s!) {
+               $t = $1;
+               if (!$core || $t =~ m!^lib/[a-z]!)
+               {
+                   push @ARGV, $t;
+                   $OVER{$t} = File::Spec->catdir($updir, $t);
+               }
            }
        }
     } else {
         warn "$0: cannot open $mani: $!\n";
     }
+    _find_tests('pod');
 }
 
 # Tests known to cause infinite loops for the perlcc tests.
@@ -146,7 +153,7 @@ EOT
            }
        }
        $te = $test;
-       chop($te);
+       $te =~ s/\.\w+$/./;
        print "$te" . '.' x ($dotdotdot - length($te));
 
        $test = $OVER{$test} if exists $OVER{$test};
@@ -175,8 +182,6 @@ EOT
            close(SCRIPT);
        }
 
-       $test = $OVER{$test} if exists $OVER{$test};
-
        my $utf = $with_utf ? '-I../lib -Mutf8' : '';
        my $testswitch = '-I. -MTestInit'; # -T will strict . from @INC
        if ($type eq 'deparse') {
@@ -189,7 +194,8 @@ EOT
                or print "can't deparse '$deparse': $!.\n";
        }
        elsif ($type eq 'perl') {
-           my $run = "./perl $testswitch $switch $utf $test |";
+           my $perl = $ENV{PERL} || './perl';
+           my $run = "$perl $testswitch $switch $utf $test |";
            open(RESULTS,$run) or print "can't run '$run': $!.\n";
        }
        else {
@@ -218,7 +224,7 @@ EOT
                    $ok = 1;
                }
                else {
-                   if (/^(not )?ok (\d+)(\s*#.*)?/ &&
+                   if (/^(not )?ok (\d+)[^#]*(\s*#.*)?/ &&
                        $2 == $next)
                    {
                        my($not, $num, $extra) = ($1, $2, $3);
@@ -249,9 +255,11 @@ EOT
        }
        if ($ENV{PERL_3LOG}) {
            my $tpp = $test;
+           $tpp =~ s:^../::;
            $tpp =~ s:/:_:g;
            $tpp =~ s:\.t$::;
-           rename("perl.3log", "perl.3log.$tpp");
+           rename("perl.3log", "perl.3log.$tpp") ||
+               die "rename: perl3.log to perl.3log.$tpp: $!\n";
        }
        $next = $next - 1;
        if ($ok && $next == $max) {