[PATCH 07/17] scripts/code_cov_parse_info: use numberic sort for line numbers

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Feb 15 16:55:54 UTC 2024


Hi Mauro,
On 2024-02-15 at 11:27:16 +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>

Small nit:

[PATCH 07/17] scripts/code_cov_parse_info: use numberic sort for

s/numberic/numeric/

with that:

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> 
> The DA and BRDA information is originally numerically sorted.
> 
> Sort it the same way at the output data.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  scripts/code_cov_parse_info | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> index d28217cc196d..56b27faee812 100755
> --- a/scripts/code_cov_parse_info
> +++ b/scripts/code_cov_parse_info
> @@ -291,6 +291,21 @@ sub parse_info_data($)
>  	close IN or die;
>  }
>  
> +sub sort_where($$)
> +{
> +	my @a = split ",", shift;
> +	my @b = split ",", shift;
> +	my $ret;
> +
> +	$ret = $a[0] <=> $b[0];
> +	return $ret if ($ret);
> +
> +	$ret = $a[1] <=> $b[1];
> +	return $ret if ($ret);
> +
> +	return $a[2] <=> $b[2];
> +}
> +
>  sub write_filtered_file($)
>  {
>  	my $filter = shift;
> @@ -332,10 +347,10 @@ sub write_filtered_file($)
>  				}
>  			}
>  
> -			foreach my $ln(sort keys %{ $record{$source}{$func}{da} }) {
> +			foreach my $ln(sort { $a <=> $b } keys %{ $record{$source}{$func}{da} }) {
>  				$filtered .= "DA:$ln," . $record{$source}{$func}{da}{$ln} . "\n";
>  			}
> -			foreach my $where(sort keys %{ $record{$source}{$func}{brda} }) {
> +			foreach my $where(sort sort_where keys %{ $record{$source}{$func}{brda} }) {
>  				my $taken = $record{$source}{$func}{brda}{$where};
>  				$taken = "-" if (!$taken);
>  				$filtered .= "BRDA:$where,$taken\n";
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list