From: Neil Horman Date: Thu, 9 Nov 2023 14:12:51 +0000 (-0500) Subject: augment test/run_tests.pl to filter indirect leaks X-Git-Tag: openssl-3.3.0-alpha1~393 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1093fa92c54cd53a64aa7fc8569f60b116847ab;p=thirdparty%2Fopenssl.git augment test/run_tests.pl to filter indirect leaks When verbosity isn't set to 1 or higher, suppress indirect leaks (i.e. only print direct leaks) to make output more human-readable. Setting V=1 on make test produces all leaks (direct and indirect) Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22678) --- diff --git a/test/run_tests.pl b/test/run_tests.pl index 90fba194b11..1f4406a49fa 100644 --- a/test/run_tests.pl +++ b/test/run_tests.pl @@ -175,6 +175,7 @@ $eres = eval { my $failure_verbosity = $openssl_args{failure_verbosity}; my @plans = (); # initial level, no plan yet my $output_buffer = ""; + my $in_indirect = 0; # We rely heavily on perl closures to make failure verbosity work # We need to do so, because there's no way to safely pass extra @@ -211,7 +212,21 @@ $eres = eval { $output_buffer = ""; # ignore comments etc. until plan } elsif ($is_test) { # result of a test pop @plans if @plans && --($plans[-1]) <= 0; - print $output_buffer if !$is_ok; + if ($output_buffer =~ /.*Indirect leak of.*/ == 1) { + my @asan_array = split("\n", $output_buffer); + foreach (@asan_array) { + if ($_ =~ /.*Indirect leak of.*/ == 1) { + $in_indirect = 1; + } else { + if ($_ =~ /^ #.*/ == 0) { + $in_indirect = 0; + } + } + print "$_\n" if !$in_indirect; + } + } else { + print $output_buffer if !$is_ok; + } print "\n".$self->as_string if !$is_ok || $failure_verbosity == 2; print "\n# ------------------------------------------------------------------------------" if !$is_ok;