From: Vincent Pit Date: Tue, 3 Nov 2009 13:17:31 +0000 (+0100) Subject: Always strip wildcard frames at the end of a suppression X-Git-Tag: v1.12~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=commitdiff_plain;h=ad65b4599d66c8cc26dedada4d994aa8faebfcd7 Always strip wildcard frames at the end of a suppression Thanks to a new Test::Valgrind::Suppressions->strip_tail helper. --- diff --git a/lib/Test/Valgrind/Parser/Suppressions/Text.pm b/lib/Test/Valgrind/Parser/Suppressions/Text.pm index 19ef138..6eb2dfc 100644 --- a/lib/Test/Valgrind/Parser/Suppressions/Text.pm +++ b/lib/Test/Valgrind/Parser/Suppressions/Text.pm @@ -21,6 +21,8 @@ This is a L object that can extract suppressions f =cut +use Test::Valgrind::Suppressions; + use base qw/Test::Valgrind::Parser::Text Test::Valgrind::Carp/; =head1 METHODS @@ -54,13 +56,7 @@ sub parse { if ($_ eq '{') { # A suppression block begins $in = 1; } elsif ($_ eq '}') { # A suppression block ends - # With valgrind 3.4.0, we can replace unknown series of frames by '...' - if ($sess->version ge '3.4.0') { - my $unknown_tail; - ++$unknown_tail while $s =~ s/(\n)\s*obj:\*\s*$/$1/; - $s .= "...\n" if $unknown_tail; - } - + $s = Test::Valgrind::Suppressions->strip_tail($sess, $s); # Strip the tail push @supps, $s; # Add the suppression that just ended to the list $s = ''; # Reset the state $in = 0; diff --git a/lib/Test/Valgrind/Suppressions.pm b/lib/Test/Valgrind/Suppressions.pm index 800a7c7..fde934c 100644 --- a/lib/Test/Valgrind/Suppressions.pm +++ b/lib/Test/Valgrind/Suppressions.pm @@ -88,6 +88,26 @@ sub generate { return $status; } +=head2 C + +Removes all wildcard frames at the end of the suppression. +Moreover, C<'...'> is appended when C C<3.4.0> or higher is used. +Returns the mangled suppression. + +=cut + +sub strip_tail { + shift; + + my ($sess, $supp) = @_; + + 1 while $supp =~ s/[^\r\n]*:\s*\*\s*$//; + # With valgrind 3.4.0, we can replace unknown series of frames by '...' + $supp .= "...\n" if $sess->version ge '3.4.0'; + + $supp; +} + =head1 SEE ALSO L, L, L, L.