scripts: twister: Fix duplicate scans

If the src_dir_path is a child of testsuite_path,
some c files might be scanned twice.

To prevent that, we check for parentage.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
Lukasz Mrugala 2024-04-22 12:11:30 +00:00 committed by Anas Nashif
commit ef792d1b9a

View file

@ -310,7 +310,13 @@ def scan_testsuite_path(testsuite_path):
except ValueError as e:
logger.error("%s: error parsing source file: %s" % (filename, e))
src_dir_pathlib_path = Path(src_dir_path)
for filename in find_c_files_in(testsuite_path):
# If we have already scanned those files in the src_dir step, skip them.
filename_path = Path(filename)
if src_dir_pathlib_path in filename_path.parents:
continue
try:
result: ScanPathResult = scan_file(filename)
if result.warnings: