$::do_nothing = $::do_nothing = 1;
require './TEST';
+our $Valgrind_Log;
my $Verbose = 0;
$Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift;
+# For valgrind summary output
+my $htoolnm;
+my $hgrind_ct;
+
if ($ARGV[0] && $ARGV[0] eq '-torture') {
shift;
$torture = 1;
# which live dual lives on CPAN.
$ENV{PERL_CORE} = 1;
-#fudge DATA for now.
-my %datahandle = qw(
- lib/bigint.t 1
- lib/bigintpm.t 1
- lib/bigfloat.t 1
- lib/bigfloatpm.t 1
- op/gv.t 1
- lib/complex.t 1
- lib/ph.t 1
- lib/soundex.t 1
- op/misc.t 1
- op/runlevel.t 1
- op/tie.t 1
- op/lex_assign.t 1
- );
-
-foreach (keys %datahandle) {
- unlink "$_.t";
-}
-
my (@tests, $re);
# [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV
# par => [
# { seq => '../ext/DB_File/t/*' },
# { seq => '../ext/IO_Compress_Zlib/t/*' },
- # { seq => '../lib/CPANPLUS/*' },
# { seq => '../lib/ExtUtils/t/*' },
# '*'
# ]
# };
- # but for now, run all directories in sequence. In particular, it would be
- # nice to get the tests in t/op/*.t able to run in parallel.
+ # but for now, run all directories in sequence.
unless (@tests) {
my @seq = <base/*.t>;
- my @next = qw(comp run cmd io re op uni mro lib porting);
+ my @next = qw(comp run cmd io re opbasic op uni mro lib porting perf);
push @next, 'japh' if $torture;
push @next, 'win32' if $^O eq 'MSWin32';
push @next, 'benchmark' if $ENV{PERL_BENCHMARK};
my @last;
push @last, sort { lc $a cmp lc $b }
_tests_from_manifest($Config{extensions}, $Config{known_extensions});
- push @last, <x2p/*.t>;
-
my %times;
if ($state) {
# Where known, collate the elapsed times by test name
@tests=grep /$re/, @tests
if $re;
+# Allow eg ./perl t/harness t/op/lc.t
+for (@tests) {
+ if (-f "../$_") {
+ $_ = "../$_";
+ s{^\.\./t/}{};
+ }
+}
+
my %options;
my $type = 'perl';
color => $color,
jobs => $jobs,
verbosity => $Verbose,
+ timer => $ENV{HARNESS_TIMER},
exec => sub {
my ($harness, $test) = @_;
$options = $options{$test} = _scan_test($test, $type);
}
+ (local $Valgrind_Log = "$test.valgrind-current") =~ s/^.*\///;
+
return [ split ' ', _cmd($options, $type) ];
},
});
+# Print valgrind output after test completes
+if ($ENV{PERL_VALGRIND}) {
+ $h->callback(
+ after_test => sub {
+ my ($job) = @_;
+ my $test = $job->[0];
+ my $vfile = "$test.valgrind-current";
+ $vfile =~ s/^.*\///;
+
+ if ( (! -z $vfile) && open(my $voutput, '<', $vfile)) {
+ print "$test: Valgrind output:\n";
+ print "$test: $_" for <$voutput>;
+ close($voutput);
+ }
+
+ (local $Valgrind_Log = "$test.valgrind-current") =~ s/^.*\///;
+
+ _check_valgrind(\$htoolnm, \$hgrind_ct, \$test);
+ }
+ );
+}
+
if ($state) {
$h->callback(
after_test => sub {
);
my $agg = $h->runtests(@tests);
+_cleanup_valgrind(\$htoolnm, \$hgrind_ct);
exit $agg->has_errors ? 1 : 0;