X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2Flib%2FTest%2FValgrind%2FTest%2FAction.pm;h=8b41a68d6239bff23f9c0b5dc196a8312fcd3c25;hb=44f0639e6ac34bdc0be52d47fe2c2df43ab1ca94;hp=6912cbd73fd0aed20d173784eddc3b81b0dff672;hpb=b41c498738a3a4ccb8742883a42e6ea5addb1afd;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/t/lib/Test/Valgrind/Test/Action.pm b/t/lib/Test/Valgrind/Test/Action.pm index 6912cbd..8b41a68 100644 --- a/t/lib/Test/Valgrind/Test/Action.pm +++ b/t/lib/Test/Valgrind/Test/Action.pm @@ -3,7 +3,7 @@ package Test::Valgrind::Test::Action; use strict; use warnings; -use base qw/Test::Valgrind::Action::Test/; +use base qw; my $extra_tests; @@ -29,14 +29,15 @@ sub report_smart { my ($self, $sess, $report) = @_; if ($report->can('is_leak') and $report->is_leak) { - my $tb = Test::Builder->new; - my $data = $report->data; - $tb->is_eq($data->{leakedbytes}, 10_000, '10_000 bytes leaked'); - $tb->is_eq($data->{leakedblocks}, 1, ' in one block'); - $tb->diag("The subsequent report was correctly caught:\n" . $report->dump) - if ($data->{leakedbytes} || 0) == 10_000 - and ($data->{leakedblocks} || 0) == 1; - return; + my $data = $report->data; + my $trace = join ' ', map { $_->[2] } @{$data->{stack} || []}[0 .. 2]; + if ($trace eq 'malloc XS_Test__Valgrind_leak Perl_pp_entersub') { + my $tb = Test::Builder->new; + $tb->diag("The subsequent report was correctly caught:\n" . $report->dump); + $tb->is_eq($data->{leakedbytes}, 10_000, '10_000 bytes leaked'); + $tb->is_eq($data->{leakedblocks}, 1, ' in one block'); + return; + } } $self->SUPER::report($sess, $report);