Whamcloud - gitweb
LU-14736 utils: Change leak_finder to use stdout 34/43934/3
authorPatrick Farrell <farr0186@gmail.com>
Sat, 5 Jun 2021 21:17:23 +0000 (17:17 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 21 Jun 2021 22:18:07 +0000 (22:18 +0000)
It is not an error for a leak checking script to find a
leak, so don't have leak_finder.pl print to stderr.  It also
prints several pieces of basic status to stderr, for which
there is no reason at all.

This makes it easier to redirect the output for interactive
use.

Signed-off-by: Patrick Farrell <farr0186@gmail.com>
Change-Id: Iab226726ca4b36ada40a305962beedc363398c37
Reviewed-on: https://review.whamcloud.com/43934
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
lustre/tests/leak_finder.pl

index a7c7abb..c230e59 100644 (file)
@@ -74,8 +74,8 @@ while ($line = <INFILE>) {
 
     if (index($type, 'alloced') >= 0) {
         if (defined($memory->{$addr})) {
-            print STDERR "*** Two allocs with the same address ($size bytes at $addr, $file:$func:$lno)\n";
-            print STDERR "    first malloc at $memory->{$addr}->{file}:$memory->{$addr}->{func}:$memory->{$addr}->{lno}, second at $file:$func:$lno\n";
+            print STDOUT "*** Two allocs with the same address ($size bytes at $addr, $file:$func:$lno)\n";
+            print STDOUT "    first malloc at $memory->{$addr}->{file}:$memory->{$addr}->{func}:$memory->{$addr}->{lno}, second at $file:$func:$lno\n";
             next;
         }
 
@@ -92,14 +92,14 @@ while ($line = <INFILE>) {
         }
     } else {
         if (!defined($memory->{$addr})) {
-            print STDERR "*** Free without malloc ($size bytes at $addr, $file:$func:$lno)\n";
+            print STDOUT "*** Free without malloc ($size bytes at $addr, $file:$func:$lno)\n";
             next;
         }
         my ($oldname, $oldsize, $oldfile, $oldfunc, $oldlno) = $memory->{$addr};
 
         if ($memory->{$addr}->{size} != $size) {
-            print STDERR "*** Free different size ($memory->{$addr}->{size} alloced, $size freed).\n";
-            print STDERR "    malloc at $memory->{$addr}->{file}:$memory->{$addr}->{func}:$memory->{$addr}->{lno}, free at $file:$func:$lno\n";
+            print STDOUT "*** Free different size ($memory->{$addr}->{size} alloced, $size freed).\n";
+            print STDOUT "    malloc at $memory->{$addr}->{file}:$memory->{$addr}->{func}:$memory->{$addr}->{lno}, free at $file:$func:$lno\n";
             next;
         }
 
@@ -117,7 +117,7 @@ my @sorted = sort {
 my $key;
 foreach $key (@sorted) {
     my ($oldname, $oldsize, $oldfile, $oldfunc, $oldlno) = $memory->{$key};
-    print STDERR "*** Leak: $memory->{$key}->{size} bytes allocated at $key ($memory->{$key}->{file}:$memory->{$key}->{func}:$memory->{$key}->{lno}, debug file line $memory->{$key}->{debug_line})\n";
+    print STDOUT "*** Leak: $memory->{$key}->{size} bytes allocated at $key ($memory->{$key}->{file}:$memory->{$key}->{func}:$memory->{$key}->{lno}, debug file line $memory->{$key}->{debug_line})\n";
 }
 
-print STDERR "maximum used: $max, amount leaked: $total\n";
+print STDOUT "maximum used: $max, amount leaked: $total\n";