From: Patrick Farrell Date: Sat, 5 Jun 2021 21:17:23 +0000 (-0400) Subject: LU-14736 utils: Change leak_finder to use stdout X-Git-Tag: 2.14.53~97 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=975b944b815412baef344f58a8325423b5d95e1e LU-14736 utils: Change leak_finder to use stdout 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 Change-Id: Iab226726ca4b36ada40a305962beedc363398c37 Reviewed-on: https://review.whamcloud.com/43934 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Aurelien Degremont --- diff --git a/lustre/tests/leak_finder.pl b/lustre/tests/leak_finder.pl index a7c7abb..c230e59 100644 --- a/lustre/tests/leak_finder.pl +++ b/lustre/tests/leak_finder.pl @@ -74,8 +74,8 @@ while ($line = ) { 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 = ) { } } 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";