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>
diff --git a/scripts/pylib/twister/twisterlib/testsuite.py b/scripts/pylib/twister/twisterlib/testsuite.py
index c3c9dae..2a132c3 100644
--- a/scripts/pylib/twister/twisterlib/testsuite.py
+++ b/scripts/pylib/twister/twisterlib/testsuite.py
@@ -310,7 +310,13 @@
         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: