From: Vincent Pit Date: Tue, 15 Sep 2009 08:19:04 +0000 (+0200) Subject: Add parser support to Test::Valgrind::Session X-Git-Tag: v1.10~19 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=37e0b9637065430b7c6633ab2b6d00c805ae3419;p=perl%2Fmodules%2FTest-Valgrind.git Add parser support to Test::Valgrind::Session --- diff --git a/lib/Test/Valgrind/Session.pm b/lib/Test/Valgrind/Session.pm index 3583c3d..c7485f1 100644 --- a/lib/Test/Valgrind/Session.pm +++ b/lib/Test/Valgrind/Session.pm @@ -246,9 +246,9 @@ sub _run { my @args = ( $self->valgrind, - '--log-fd=' . fileno($vwtr), $self->tool->args($self), @supp_args, + $self->parser->args($self, $vwtr), $self->command->args($self), ); @@ -265,7 +265,7 @@ sub _run { close $vwtr or $self->_croak("close(\$vwtr): $!"); - $self->tool->parse($self, $vrdr); + $self->parser->parse($self, $vrdr); $self->{exit_code} = (waitpid($pid, 0) == $pid) ? $? >> 8 : 255; @@ -292,7 +292,7 @@ Read-only accessor for the C associated to the current run. my @members; BEGIN { - @members = qw/action tool command/; + @members = qw/action tool command parser/; for (@members) { eval "sub $_ { \@_ <= 1 ? \$_[0]->{$_} : (\$_[0]->{$_} = \$_[1]) }"; die if $@; @@ -377,7 +377,7 @@ sub start { my %args = @_; - for (@members) { + for (qw/action tool command/) { my $base = 'Test::Valgrind::' . ucfirst; my $value = $args{$_}; $self->_croak("Invalid $_") unless Scalar::Util::blessed($value) @@ -388,6 +388,7 @@ sub start { delete @{$self}{qw/last_status exit_code/}; $self->tool->start($self); + $self->parser($self->tool->parser_class->new)->start($self); $self->action->start($self); return; @@ -401,6 +402,7 @@ Forwards to C<< ->action->abort >> after unshifting the session object to the ar sub abort { my $self = shift; + $self->action->abort($self, @_); } @@ -415,8 +417,10 @@ sub report { return unless defined $report; - $report = $self->command->filter($self, $report); - return unless defined $report; + for my $handler (qw/tool command/) { + $report = $self->$handler->filter($self, $report); + return unless defined $report; + } $self->action->report($self, $report); } @@ -432,7 +436,9 @@ sub finish { my ($self) = @_; my $action = $self->action; + $action->finish($self); + $self->parser->finish($self); $self->tool->finish($self); my $status = $action->status($self); @@ -453,7 +459,7 @@ sub status { $_[0]->{last_status} } =head1 SEE ALSO -L, L, L, L. +L, L, L, L, L. L, L.