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

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Feb 15 10:27:26 UTC 2024


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>
---
 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