@grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
@echo "And of course you have to have valgrind..."
$(VALGRIND) $(VG_TEST) || exit 1
- PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(RUN_TESTS) choose
+ PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' TESTFILE=harness $(RUN_TESTS) choose
!NO!SUBS!
;;
esac
if ($ENV{PERL_VALGRIND}) {
my $perl_supp = $options->{return_dir} ? "$options->{return_dir}/perl.supp" : "perl.supp";
my $valgrind_exe = $ENV{VALGRIND} // 'valgrind';
+ if ($options->{run_dir}) {
+ $Valgrind_Log = "$options->{run_dir}/$Valgrind_Log";
+ }
my $vg_opts = $ENV{VG_OPTS}
- // '--log-fd=3 '
+ // "--log-file=$Valgrind_Log "
. "--suppressions=$perl_supp --leak-check=yes "
. "--leak-resolution=high --show-reachable=yes "
- . "--num-callers=50 --track-origins=yes";
+ . "--num-callers=50 --track-origins=yes";
$perl = "$valgrind_exe $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}";
$::do_nothing = $::do_nothing = 1;
require './TEST';
+our $Valgrind_Log;
my $Verbose = 0;
$Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift;
$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/^.*\///;
+
+ open(my $voutput, '<', $vfile) or return;
+ print "$test: Valgrind output:\n";
+ print "$test: $_" for <$voutput>;
+ close($voutput);
+ }
+ );
+}
+
if ($state) {
$h->callback(
after_test => sub {