8 use Test::Valgrind::Command;
9 use Test::Valgrind::Tool;
10 use Test::Valgrind::Session;
12 my $cmd = Test::Valgrind::Command->new(
17 my $tool = Test::Valgrind::Tool->new(
22 package Test::Valgrind::Action::Dummy;
24 use base 'Test::Valgrind::Action';
26 sub do_suppressions { 0 }
29 my $dummy_action = Test::Valgrind::Action::Dummy->new();
31 my $sess = eval { Test::Valgrind::Session->new(
32 min_version => $tool->requires_version,
36 $err =~ s/^(Empty valgrind candidates list|No appropriate valgrind executable could be found)\s+at.*/$1/;
37 plan skip_all => $err;
45 my $file = $sess->def_supp_file;
46 my $VERSION = quotemeta $Test::Valgrind::Session::VERSION;
47 my $exp = qr!$VERSION/memcheck-\d+(?:\.\d+)*-[0-9a-f]{32}\.supp$!;
48 like $file, $exp, 'default suppression file is correctly named';
50 my $res = open my $supp_fh, '<', $file;
52 ok $res, 'default suppression file can be opened';
53 diag "open($file): $err" unless $res;
56 my ($count, $non_empty, $perl_related) = (0, 0, 0);
57 my ($in, $valid_frames, $seen_perl);
62 if (!$in && $_ eq '{') {
69 ++$non_empty if $valid_frames;
70 ++$perl_related if $seen_perl;
73 ++$valid_frames if /^\s*fun:/;
74 ++$seen_perl if /^\s*fun:Perl_/;
78 diag "The default suppression file contains $count suppressions, of which $non_empty are not empty and $perl_related apply to perl";
82 $sess = eval { Test::Valgrind::Session->new(
84 extra_supp => [ 't/supp/no_perl' ],
88 action => $dummy_action,
90 like $@, qr/No compatible suppressions available/,
91 'incompatible suppression file';
93 $sess = eval { Test::Valgrind::Session->new(
96 extra_supp => [ 't/supp/no_perl' ],
100 action => $dummy_action,
102 is $@, '', 'incompatible suppression file, but forced';