]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Suppressions.pm
Make Suppressions->strip_tail remove multiple ellipsis
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Suppressions.pm
index 800a7c79bc94c5ed87a68f2d997e7e50307c5edc..3af3a9847631fb3025c7857709b2f4a0ff77287e 100644 (file)
@@ -88,6 +88,29 @@ sub generate {
  return $status;
 }
 
+=head2 C<strip_tail $session, $suppression>
+
+Removes all wildcard frames at the end of the suppression.
+Moreover, C<'...'> is appended when C<valgrind> 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 '...'
+ if ($sess->version ge '3.4.0') {
+  1 while $supp =~ s/[^\r\n]*\.{3}\s*$//;
+  $supp .= "...\n";
+ }
+
+ $supp;
+}
+
 =head1 SEE ALSO
 
 L<Test::Valgrind>, L<Test::Valgrind::Command>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Action::Suppressions>.