[PATCH 09/17] scripts/code_cov_parse_info: stop recording/writing too old fields

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Feb 15 19:55:00 UTC 2024


On Thu, 15 Feb 2024 18:09:46 +0100
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:

> Hi Mauro,
> On 2024-02-15 at 11:27:18 +0100, Mauro Carvalho Chehab wrote:
> > From: Mauro Carvalho Chehab <mchehab at kernel.org>
> > 
> > As we'll be using json as basis, drop support for the fields that:
> > 
> > - aren't used at the reports;
> > - aren't even present when lcov parses gcc json format.
> > 
> > Such fields are only handled on lcov for very old gcc versions.
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> > ---
> >  scripts/code_cov_parse_info | 33 ---------------------------------
> >  1 file changed, 33 deletions(-)
> > 
> > diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> > index 92091215d224..038440a9c3e3 100644
> > --- a/scripts/code_cov_parse_info
> > +++ b/scripts/code_cov_parse_info
> > @@ -201,15 +201,10 @@ sub parse_info_data($)
> >  
> >  		# FNF:<number of functions found>
> >  		if (m/^FNF:(-?\d+)/) {
> > -			$record{$source}{func}{$func}{fnf} = $1;
> >  			next;
> >  		}
> >  		# FNH:<number of function hit>
> >  		if (m/^FNH:(-?\d+)/) {
> > -			my $hits = $1;
> > -			if (!defined($record{$source}{func}{$func}{fnh}) || $record{$source}{func}{$func}{fnh} < $hits) {
> > -				$record{$source}{func}{$func}{fnh} = $hits;
> > -			}
> >  			next;
> >  		}
> >  
> > @@ -240,15 +235,10 @@ sub parse_info_data($)
> >  
> >  		# BRF:<number of branches found>
> >  		if (m/^BRF:(-?\d+)/) {
> > -			$record{$source}{func}{$func}{brf} = $1;
> >  			next;
> >  		}
> >  		# BRH:<number of branches hit>
> >  		if (m/^BRH:(-?\d+)/) {
> > -			my $hits = $1;
> > -			if (!defined($record{$source}{func}{$func}{brh}) || $record{$source}{func}{$func}{brh} < $hits) {
> > -				$record{$source}{func}{$func}{brh} = $hits;
> > -			}  
> 
> Above is self-explanatory.
> 
> >  			next;
> >  		}
> >  
> > @@ -340,34 +330,11 @@ sub write_filtered_file($)
> >  				if (defined($record{$source}{func}{$func}{fnda})) {
> >  					$filtered .= "FNDA:" . $record{$source}{func}{$func}{fnda} . ",$func\n";
> >  				}
> > -				if ($record{$source}{fnf}) {
> > -					$filtered .= "FNF:". $record{$source}{func}{$func}{fnf} ."\n";
> > -				}
> > -				if ($record{$source}{fnh}) {
> > -					$filtered .= "FNH:". $record{$source}{func}{$func}{fnh} ."\n";
> > -				}
> > -			}
> >  
> > -			foreach my $ln(sort { $a <=> $b } keys %{ $record{$source}{func}{$func}{da} }) {
> > -				$filtered .= "DA:$ln," . $record{$source}{func}{$func}{da}{$ln} . "\n";  
> 
> Why are you removing DA here? It is used elswhere.
> 
> >  			}
> > -			foreach my $where(sort sort_where keys %{ $record{$source}{func}{$func}{brda} }) {
> > -				my $taken = $record{$source}{func}{$func}{brda}{$where};  
> 
> Same here, BRDA.
> 
> >  				$taken = "-" if (!$taken);
> >  				$filtered .= "BRDA:$where,$taken\n";
> >  			}
> > -			if ($record{$source}{func}{$func}{brf}) {
> > -				$filtered .= "BRF:". $record{$source}{func}{$func}{brf} ."\n";
> > -			}
> > -			if ($record{$source}{func}{$func}{brh}) {
> > -				$filtered .= "BRH:". $record{$source}{func}{$func}{brh} ."\n";
> > -			}
> > -			if ($record{$source}{func}{$func}{lf}) {
> > -				$filtered .= "LF:". $record{$source}{func}{$func}{lf} ."\n";
> > -			}
> > -			if ($record{$source}{func}{$func}{lh}) {
> > -				$filtered .= "LH:". $record{$source}{func}{$func}{lh} ."\n";  
> 
> LF and LH?
> 
> If above is correct you can add my a-b
> 
> Acked-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Basically, lcov has support for different versions of gcov and has
some sort of backward compatibility with older versions of lcov
tool. In practice, those fields aren't either be filled anymore for
a long time or just provide duplicated (incomplete) information.

The rationale behind this patch is to remove those duplicated info
from old versions that are either duplicated or not filled anymore
by gcov/lcov versions on Ubuntu 18.04 and above[1]. 

[1] btw, this script was never tested with versions older than
what's there on Ubuntu 18.04, so what has been removed is something
that it was not really used in practice.

> 
> > -			}
> >  		}
> >  
> >  		$filtered .= "end_of_record\n";
> > -- 
> > 2.43.0
> >   


More information about the igt-dev mailing list