[PATCH 17/17] scripts/code_cov_parse_info: better check if source file exists

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Feb 15 17:24:02 UTC 2024


Hi Mauro,
On 2024-02-15 at 11:27:26 +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> Not sure why, but opening a non-exisiting file is not returning
> an error. Well, let's add another check to cover troubles, by
> identifying if no lines were filled at the cache array.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>

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

> ---
>  scripts/code_cov_parse_info | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> index 9d043a987f44..d133ef1a18d4 100755
> --- a/scripts/code_cov_parse_info
> +++ b/scripts/code_cov_parse_info
> @@ -614,6 +614,7 @@ sub read_info($)
>  					close IN;
>  				}
>  				my $nlines = scalar(@{$cached{$source}});
> +				die "File $source_dir/$source not found or it is empty. Can't filter branches\n" if (!$nlines);
>  				if ($ln > $nlines) {
>  					die "$source:$ln line is bigger than the number of lines at the file ($nlines lines)\n";
>  					return;
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list