]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Tool/memcheck.pm
Miscellanous doc nits
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Tool / memcheck.pm
index 1302efefc3750ed7b3af24b088382dacb3b78340..3600937dcdaa4cb9520f5fc99f43e0f138e6d0a0 100644 (file)
@@ -9,15 +9,15 @@ Test::Valgrind::Tool::memcheck - Run an analysis through the memcheck tool.
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
-This tool parses the XML output of a C<memcheck> run with L<XML::Twig>.
+This class contains the information required by the session for running the C<memcheck> tool.
 
 =cut
 
@@ -73,9 +73,28 @@ sub callers { $_[0]->{callers} }
 
 sub suppressions_tag { 'memcheck-' . $_[1]->version }
 
+=head2 C<parser_class $session>
+
+This tool uses a L<Test::Valgrind::Parser::XML::Twig> parser in analysis mode, and a L<Test::Valgrind::Parser::Suppressions::Text> parser in suppressions mode.
+
+=cut
+
+sub parser_class {
+ my ($self, $session) = @_;
+
+ my $class = $session->do_suppressions
+           ? 'Test::Valgrind::Parser::Suppressions::Text'
+           : 'Test::Valgrind::Parser::XML::Twig';
+
+ local $@;
+ eval "require $class";
+
+ return $class;
+}
+
 =head2 C<report_class $session>
 
-This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in analysis mode.
+This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in analysis mode, and C<Test::Valgrind::Report::Suppressions> object reports in suppressions mode.
 
 =cut
 
@@ -99,10 +118,8 @@ sub args {
   '--error-limit=yes',
  );
 
- unless ($sess->do_suppressions) {
-  push @args, '--track-origins=yes' if $sess->version ge '3.4.0';
-  push @args, '--xml=yes';
- }
+ push @args, '--track-origins=yes' if  $sess->version ge '3.4.0'
+                                   and not $sess->do_suppressions;
 
  push @args, $self->SUPER::args(@_);
 
@@ -113,8 +130,6 @@ sub args {
 
 L<Test::Valgrind>, L<Test::Valgrind::Tool>.
 
-L<XML::Twig>.
-
 =head1 AUTHOR
 
 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
@@ -146,7 +161,7 @@ package Test::Valgrind::Tool::memcheck::Report;
 
 use base qw/Test::Valgrind::Report/;
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 my @kinds = qw/
  InvalidFree