1 package Test::Valgrind::Test::Action;
6 use base qw/Test::Valgrind::Action::Test/;
12 require Test::Valgrind;
14 XSLoader::load('Test::Valgrind', $Test::Valgrind::VERSION);
20 *report = *report_smart;
26 sub new { shift->SUPER::new(extra_tests => $extra_tests) }
29 my ($self, $sess, $report) = @_;
31 if ($report->can('is_leak') and $report->is_leak) {
32 my $data = $report->data;
33 my $trace = join ' ', map { $_->[2] } @{$data->{stack} || []}[0 .. 2];
34 if ($trace eq 'malloc XS_Test__Valgrind_leak Perl_pp_entersub') {
35 my $tb = Test::Builder->new;
36 $tb->diag("The subsequent report was correctly caught:\n" . $report->dump);
37 $tb->is_eq($data->{leakedbytes}, 10_000, '10_000 bytes leaked');
38 $tb->is_eq($data->{leakedblocks}, 1, ' in one block');
43 $self->SUPER::report($sess, $report);