summaryrefslogtreecommitdiffstats
path: root/tools/valgrind_test_cleaner.pl
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>2011-02-25 19:04:32 +0100
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>2011-02-25 19:04:32 +0100
commit6458b98ea487620fd4c47b0de5b5bc2e5fe97794 (patch)
tree7752e18beeb76ba3412982d7e368f137568252ef /tools/valgrind_test_cleaner.pl
parent[trac614] Enable tracing of file descriptor (diff)
downloadkea-6458b98ea487620fd4c47b0de5b5bc2e5fe97794.tar.xz
kea-6458b98ea487620fd4c47b0de5b5bc2e5fe97794.zip
[trac614] Add a cleaner of the valgrind output
Diffstat (limited to 'tools/valgrind_test_cleaner.pl')
-rwxr-xr-xtools/valgrind_test_cleaner.pl45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/valgrind_test_cleaner.pl b/tools/valgrind_test_cleaner.pl
new file mode 100755
index 0000000000..7f8f432eeb
--- /dev/null
+++ b/tools/valgrind_test_cleaner.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my ($block, $blockOK);
+
+sub endBlock(_) {
+ return unless $block;
+ if ($blockOK) {
+ print @$block;
+ }
+ undef $block;
+ undef $blockOK;
+}
+
+sub startBlock(_) {
+ $block = [@_];
+}
+
+sub addToBlock(_) {
+ my ($line) = @_;
+ push @$block, $line;
+ return unless $line =~ /^==\d+==\s+(at|by) 0x[0-9A-F]+: (.*) \(.+:\d+\)$/;
+ $_ = $2;
+ return $blockOK = 1 if /^isc::/;
+ return $blockOK = 1 if /^asiolink:/;
+ return if /^main \(/;
+ return if /^testing::/;
+ return if /^\(anonymous namespace\)::/;
+ $blockOK = 1;
+}
+
+while(<>) {
+ if (/^==\d+==\s*$/) {
+ print;
+ endBlock;
+ } elsif (/^==\d+==\s+\d+bytes.*lost in loss record/) {
+ startBlock;
+ } elsif ($block) {
+ addToBlock;
+ } else {
+ print;
+ }
+}
+endBlock;