]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Tool/memcheck.pm
This is 1.19
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Tool / memcheck.pm
index 693a93fccbafc2e0f35fa96d3eb90294e37ed998..27a2a62eed0abe2d820f151d5ff77fc1849959e6 100644 (file)
@@ -9,11 +9,11 @@ Test::Valgrind::Tool::memcheck - Run an analysis through the memcheck tool.
 
 =head1 VERSION
 
-Version 1.14
+Version 1.19
 
 =cut
 
-our $VERSION = '1.14';
+our $VERSION = '1.19';
 
 =head1 DESCRIPTION
 
@@ -21,6 +21,8 @@ This class contains the information required by the session for running the C<me
 
 =cut
 
+use Scalar::Util ();
+
 use base qw<Test::Valgrind::Tool>;
 
 =head1 METHODS
@@ -58,8 +60,11 @@ sub new {
 
  my %args = @_;
 
- my $callers = delete $args{callers} || 12;
- $callers =~ s/\D//g;
+ my $callers = delete $args{callers};
+ $callers = 24 unless $callers;
+ die 'Invalid number of callers'
+            unless Scalar::Util::looks_like_number($callers) and $callers > 0
+                                                             and $callers <= 24;
 
  my $self = bless $class->Test::Valgrind::Tool::new(%args), $class;
 
@@ -68,7 +73,7 @@ sub new {
  $self;
 }
 
-sub new_trainer { shift->new(callers => 50) }
+sub new_trainer { shift->new(callers => 24) }
 
 =head2 C<callers>
 
@@ -97,8 +102,10 @@ sub parser_class {
            ? 'Test::Valgrind::Parser::Suppressions::Text'
            : 'Test::Valgrind::Parser::XML::Twig';
 
- local $@;
- eval "require $class";
+ {
+  local $@;
+  eval "require $class; 1" or die $@;
+ }
 
  return $class;
 }
@@ -114,8 +121,12 @@ This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in anal
 sub report_class {
  my ($self, $session) = @_;
 
- $session->do_suppressions ? 'Test::Valgrind::Report::Suppressions'
-                           : 'Test::Valgrind::Tool::memcheck::Report'
+ if ($session->do_suppressions) {
+  require Test::Valgrind::Parser::Suppressions::Text;
+  return 'Test::Valgrind::Report::Suppressions';
+ } else {
+  return 'Test::Valgrind::Tool::memcheck::Report';
+ }
 }
 
 sub args {
@@ -131,7 +142,7 @@ sub args {
   '--error-limit=yes',
  );
 
- push @args, '--track-origins=yes' if  $sess->version ge '3.4.0'
+ push @args, '--track-origins=yes' if  $sess->version >= '3.4.0'
                                    and not $sess->do_suppressions;
 
  push @args, $self->SUPER::args(@_);
@@ -162,7 +173,7 @@ You can find documentation for this module with the perldoc command.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009,2010,2011,2013 Vincent Pit, all rights reserved.
+Copyright 2009,2010,2011,2013,2015,2016 Vincent Pit, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
 
@@ -174,7 +185,7 @@ package Test::Valgrind::Tool::memcheck::Report;
 
 use base qw<Test::Valgrind::Report>;
 
-our $VERSION = '1.14';
+our $VERSION = '1.19';
 
 my @kinds = qw<
  InvalidFree