X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FTool%2Fmemcheck.pm;h=1213b7b29c71d8c365649e762c397aed15a92ed9;hb=d44c95e8e9820ee69e76506bde7c2c5fbe37b568;hp=e75f0c0dd0dda9492d35666052f1d588dbd952f5;hpb=08f451d35014a7f8587fba4bc20103a018487653;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/lib/Test/Valgrind/Tool/memcheck.pm b/lib/Test/Valgrind/Tool/memcheck.pm index e75f0c0..1213b7b 100644 --- a/lib/Test/Valgrind/Tool/memcheck.pm +++ b/lib/Test/Valgrind/Tool/memcheck.pm @@ -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 run with L. +This class contains the information required by the session for running the C tool. =cut @@ -73,13 +73,37 @@ sub callers { $_[0]->{callers} } sub suppressions_tag { 'memcheck-' . $_[1]->version } -=head2 C +=head2 C + +This tool uses a C parser in analysis mode, and a C 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 This tool emits C object reports in analysis mode. =cut -sub report_class_analysis { 'Test::Valgrind::Tool::memcheck::Report' } +sub report_class { + my ($self, $session) = @_; + + $session->do_suppressions ? 'Test::Valgrind::Report::Suppressions' + : 'Test::Valgrind::Tool::memcheck::Report' +} sub args { my $self = shift; @@ -94,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(@_); @@ -108,8 +130,6 @@ sub args { L, L. -L. - =head1 AUTHOR Vincent Pit, C<< >>, L. @@ -141,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