Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42A7410F6E3 for ; Mon, 4 Apr 2022 06:26:51 +0000 (UTC) From: Mauro Carvalho Chehab To: igt-dev@lists.freedesktop.org, Petri Latvala Date: Mon, 4 Apr 2022 08:26:38 +0200 Message-Id: <20220404062642.378928-9-mauro.chehab@linux.intel.com> In-Reply-To: <20220404062642.378928-1-mauro.chehab@linux.intel.com> References: <20220404062642.378928-1-mauro.chehab@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH 08/12] scripts/code_cov_parse_info: better handle test name List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ch Sai Gowtham , Andrzej Hajda Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Mauro Carvalho Chehab The TN field generated by standard lcov is weird: it keeps repeating the TN field from time to time. At genhtml, it seems that only the first one is used. As we're using TN to indicate the test name, preserve all different test names at the output file. Also, printing such names doesn't really makes sense when --print-used and --print-unused command line options are used, and printing a list of 100+ names won't make much sense. So, just remove printing the test names. Reviewed-by: Ch Sai Gowtham Signed-off-by: Mauro Carvalho Chehab --- scripts/code_cov_parse_info | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info index 604812b41580..3e1525a67d99 100755 --- a/scripts/code_cov_parse_info +++ b/scripts/code_cov_parse_info @@ -17,8 +17,8 @@ my %used_source; my %record; my %files; my @func_regexes; +my %test_names; my @src_regexes; -my $testname = ""; my $verbose = 0; my $ignore_unused = 0; @@ -99,11 +99,7 @@ sub parse_info_data($) if (m/^TN:(.*)/) { if ($1 ne $cur_test) { $cur_test = $1; - if (!$testname) { - $testname = $cur_test; - } else { - $testname = "Code_coverage_tests"; - } + $test_names{$cur_test} = 1; } $source = $before_sf; $func = $before_sf; @@ -297,9 +293,13 @@ sub write_filtered_file($) { my $filter = shift; - # Generates filtered data - my $filtered = "TN:$testname\n"; + my $filtered = ""; + + foreach my $testname(sort keys %test_names) { + $filtered .= "TN:$testname\n"; + } + # Generates filtered data foreach my $source(sort keys %record) { next if (!$used_source{$source}); @@ -363,10 +363,6 @@ sub print_code_coverage($$$) return if (!$print_used && !$print_unused); - if ($testname ne "") { - $testname =~ s/(.*)_on_(\w+)$/$1 on $2/; - print "TEST: $testname\n"; - } my $prev_file = ""; foreach my $func (sort keys(%all_func)) { -- 2.35.1