This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move ExtUtils::ParseXS from cpan/ to dist/
[perl5.git] / t / TEST
diff --git a/t/TEST b/t/TEST
index 10a0e85..23edf87 100755 (executable)
--- a/t/TEST
+++ b/t/TEST
@@ -33,14 +33,12 @@ my %abs = (
           '../cpan/AutoLoader' => 1,
           '../cpan/CPAN' => 1,
           '../cpan/Class-ISA' => 1,
-          '../cpan/Cwd' => 1,
           '../cpan/Devel-PPPort' => 1,
           '../cpan/Encode' => 1,
           '../cpan/ExtUtils-Command' => 1,
           '../cpan/ExtUtils-Constant' => 1,
           '../cpan/ExtUtils-MakeMaker' => 1,
           '../cpan/ExtUtils-Manifest' => 1,
-          '../cpan/ExtUtils-ParseXS' => 1,
           '../cpan/File-Fetch' => 1,
           '../cpan/IPC-Cmd' => 1,
           '../cpan/IPC-SysV' => 1,
@@ -61,8 +59,11 @@ my %abs = (
           '../cpan/Tie-File' => 1,
           '../cpan/bignum' => 1,
           '../cpan/podlators' => 1,
+          '../dist/Cwd' => 1,
+          '../dist/ExtUtils-Install' => 1,
+          '../dist/ExtUtils-ParseXS' => 1,
          );
-             
+
 my %temp_no_core =
     ('../cpan/B-Debug' => 1,
      '../cpan/Compress-Raw-Bzip2' => 1,
@@ -85,12 +86,26 @@ my %temp_no_core =
      '../cpan/Unicode-Normalize' => 1,
     );
 
+# delete env vars that may influence the results
+# but allow override via *_TEST env var if wanted
+# (e.g. PERL5OPT_TEST=-d:NYTProf)
+for my $envname (qw(PERL5LIB PERLLIB PERL5OPT)) {
+    my $override = $ENV{"${envname}_TEST"};
+    if (defined $override) {
+       warn "$0: $envname=$override\n";
+       $ENV{$envname} = $override;
+    }
+    else {
+       delete $ENV{$envname};
+    }
+}
+
 if ($::do_nothing) {
     return 1;
 }
 
 # Location to put the Valgrind log.
-my $Valgrind_Log = 'current.valgrind';
+our $Valgrind_Log;
 
 $| = 1;
 
@@ -98,10 +113,6 @@ $| = 1;
 #BEGIN { require '../lib/strict.pm'; "strict"->import() };
 #BEGIN { require '../lib/warnings.pm'; "warnings"->import() };
 
-delete $ENV{PERL5LIB};
-delete $ENV{PERLLIB};
-delete $ENV{PERL5OPT};
-
 # remove empty elements due to insertion of empty symbols via "''p1'" syntax
 @ARGV = grep($_,@ARGV) if $^O eq 'VMS';
 our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0;
@@ -233,7 +244,7 @@ sub _scan_test {
            $lib = '../../lib';
            $perl = '../../t/perl';
            $testswitch = "-I../.. -MTestInit=U2T";
-           if ($2 eq 'cpan') {
+           if ($2 eq 'cpan' || $2 eq 'dist') {
                if($abs{$run_dir}) {
                    $testswitch = $testswitch . ',A';
                }
@@ -246,7 +257,7 @@ sub _scan_test {
        }
     }
 
-    my $utf8 = $::with_utf8 ? "-I$lib -Mutf8" : '';
+    my $utf8 = ($::with_utf8 || $::with_utf16) ? "-I$lib -Mutf8" : '';
 
     my %options = (
        perl => $perl,
@@ -285,13 +296,17 @@ sub _cmd {
         my $redir = $^O eq 'VMS' ? '2>&1' : '';
 
         if ($ENV{PERL_VALGRIND}) {
+            my $perl_supp = $options->{return_dir} ? "$options->{return_dir}/perl.supp" : "perl.supp";
             my $valgrind = $ENV{VALGRIND} // 'valgrind';
             my $vg_opts = $ENV{VG_OPTS}
-              //  "--suppressions=perl.supp --leak-check=yes "
+              //  "--suppressions=$perl_supp --leak-check=yes "
                 . "--leak-resolution=high --show-reachable=yes "
-                  . "--num-callers=50";
+                  . "--num-callers=50 --track-origins=yes";
             $perl = "$valgrind --log-fd=3 $vg_opts $perl";
             $redir = "3>$Valgrind_Log";
+            if ($options->{run_dir}) {
+                $Valgrind_Log = "$options->{run_dir}/$Valgrind_Log";
+            }
         }
 
         my $args = "$options->{testswitch} $options->{switch} $options->{utf8}";
@@ -538,6 +553,7 @@ EOT
            $te = '';
        }
 
+        (local $Valgrind_Log = "$test.valgrind-current") =~ s/^.*\///;
        my $results = _run_test($test, $type);
 
        my $failure;