Revision history for Test-Valgrind
+0.04 2008-05-13 16:25 UTC
+ + Chg : Don't smoke this on 5.005 please.
+ + Chg : Better way to find the valgrind executable.
+
0.03 2008-04-21 15:35 UTC
+ Fix : Include the mock Suppressions.pm rather than an empty file.
+use 5.006;
+
use strict;
use warnings;
use ExtUtils::MakeMaker;
-my $has_vg = 0;
my $vg;
print 'Checking for valgrind >= 3.1.0 in PATH... ';
for (split /:/, $ENV{PATH}) {
- $vg = $_ . '/valgrind';
- if (-x $vg) {
- my $ver = qx/$vg --version/;
+ $_ .= '/valgrind';
+ if (-x) {
+ my $ver = qx/$_ --version/;
if ($ver =~ s/^valgrind-//) {
$ver = join '', map chr, split /\./, $ver;
if ($ver ge v3.1.0) {
- print "yes, $vg\n";
- $has_vg = 1;
+ print "yes, $_\n";
+ $vg = $_;
last;
}
}
}
}
-if (!$has_vg) {
+if (!$vg) {
print "no\n";
die 'OS unsupported';
}
=head1 VERSION
-Version 0.03
+Version 0.04
=cut
-our $VERSION = '0.03';
+our $VERSION = '0.04';
=head1 SYNOPSIS
$file = $next;
}
return if not $file or $file eq '-e';
- my $valgrind;
- for (split /:/, $ENV{PATH}) {
- my $vg = $_ . '/valgrind';
- if (-x $vg) {
- $valgrind = $vg;
- last;
- }
- }
- if (!$valgrind) {
- plan skip_all => 'No valgrind executable could be found in your path';
- return;
- }
my $callers = $args{callers} || 50;
$callers = int $callers;
+ my $vg = Test::Valgrind::Suppressions::VG_PATH;
+ if (!$vg || !-x $vg) {
+ for (split /:/, $ENV{PATH}) {
+ $_ .= '/valgrind';
+ if (-x) {
+ $vg = $_;
+ last;
+ }
+ }
+ if (!$vg) {
+ plan skip_all => 'No valgrind executable could be found in your path';
+ return;
+ }
+ }
pipe my $rdr, my $wtr or croak "pipe(\$rdr, \$wtr): $!";
my $pid = fork;
if (!defined $pid) {
print STDERR "valgrind @args\n" if $args{diag};
local $ENV{PERL_DESTRUCT_LEVEL} = 3;
local $ENV{PERL_DL_NONLAZY} = 1;
- my $vg = Test::Valgrind::Suppressions::VG_PATH;
exec $vg, @args if $vg and -x $vg;
}
close $wtr or croak "close(\$wtr): $!";