]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Tool/memcheck.pm
Get rid of all pointers to Test::Valgrind::Tool::SuppressionsParser
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Tool / memcheck.pm
index 790587159ff22f29c8fc6948317d9c9b555bc587..05f77bdf7be145aefefb42f6bae56e1b3ec7f52d 100644 (file)
@@ -9,11 +9,11 @@ Test::Valgrind::Tool::memcheck - Run an analysis through the memcheck tool.
 
 =head1 VERSION
 
-Version 1.00
+Version 1.02
 
 =cut
 
-our $VERSION = '1.00';
+our $VERSION = '1.02';
 
 =head1 DESCRIPTION
 
@@ -21,11 +21,11 @@ This tool parses the XML output of a C<memcheck> run with L<XML::Twig>.
 
 =cut
 
-use base qw/Test::Valgrind::Tool::SuppressionsParser Test::Valgrind::Tool/;
+use base qw/Test::Valgrind::Tool/;
 
 =head1 METHODS
 
-This class inherits L<Test::Valgrind::Tool> and L<Test::Valgrind::Tool::SuppressionsParser>.
+This class inherits L<Test::Valgrind::Tool>.
 
 =head2 C<requires_version>
 
@@ -79,7 +79,7 @@ Read-only accessor for the underlying L<XML::Twig> parser.
 
 =cut
 
-sub twig    { $_[0]->{twig} }
+sub twig { $_[0]->{twig} }
 
 sub suppressions_tag { 'memcheck-' . $_[1]->version }
 
@@ -92,7 +92,8 @@ This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in anal
 sub report_class_analysis { 'Test::Valgrind::Tool::memcheck::Report' }
 
 sub args {
- my ($self, $sess) = @_;
+ my $self = shift;
+ my ($sess) = @_;
 
  my @args = (
   '--tool=memcheck',
@@ -108,7 +109,7 @@ sub args {
   push @args, '--xml=yes';
  }
 
- push @args, $self->SUPER::args();
+ push @args, $self->SUPER::args(@_);
 
  return @args;
 }
@@ -121,9 +122,6 @@ sub _session { @_ <= 1 ? $_[0]->{_session} : ($_[0]->{_session} = $_[1]) }
 sub start {
  my ($self, $sess) = @_;
 
- $self->_croak('This memcheck tool can\'t be run in two sessions at once')
-                                                             if $self->_session;
-
  $self->SUPER::start($sess);
  $self->_session($sess);
 
@@ -144,14 +142,14 @@ sub finish {
  my ($self, $sess) = @_;
 
  $self->_session(undef);
- $self->SUPER::start($sess);
+ $self->SUPER::finish($sess);
 
  return;
 }
 
 =head1 SEE ALSO
 
-L<Test::Valgrind>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Tool::SuppressionsParser>.
+L<Test::Valgrind>, L<Test::Valgrind::Tool>.
 
 L<XML::Twig>.
 
@@ -186,9 +184,7 @@ package Test::Valgrind::Tool::memcheck::Report;
 
 use base qw/Test::Valgrind::Report/;
 
-use Config qw/%Config/;
-
-our $VERSION = '1.00';
+our $VERSION = '1.02';
 
 my @kinds = qw/
  InvalidFree
@@ -217,7 +213,11 @@ sub valid_kind { exists $kinds_hashed{$_[1]} }
 
 sub is_leak    { $_[0]->kind =~ /^Leak_/ ? 1 : '' }
 
-my $pad = 2 * ($Config{ptrsize} || 4);
+my $pad;
+BEGIN {
+ require Config;
+ $pad = 2 * ($Config::Config{ptrsize} || 4);
+}
 
 sub dump {
  my ($self) = @_;
@@ -256,7 +256,7 @@ sub dump {
 
 package Test::Valgrind::Tool::memcheck::Twig;
 
-our $VERSION = '1.00';
+our $VERSION = '1.02';
 
 use Scalar::Util;
 
@@ -321,13 +321,14 @@ sub handle_error {
                                      $origin->kid('stack')->children('frame') ];
  }
 
- my $report = Test::Valgrind::Tool::memcheck::Report->new(
+ my $tool = $twig->stash->{tool};
+ my $sess = $tool->_session;
+
+ $sess->report($tool->report_class($sess)->new(
   kind => $kind,
   id   => $id,
   data => $data,
- );
-
- $twig->stash->{tool}->_session->report($report);
+ ));
 
  $twig->purge;
 }
@@ -336,7 +337,7 @@ sub handle_error {
 
 package Test::Valgrind::Tool::memcheck::Twig::Elt;
 
-our $VERSION = '1.00';
+our $VERSION = '1.02';
 
 BEGIN { require XML::Twig; }