mirror of
https://github.com/apache/nuttx.git
synced 2025-12-12 22:05:54 +08:00
gcov.py: Add copy skip path, prevent recursion
When the copy path is a subdirectory of the source path, the copy will occur recursively Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
b1d97688b7
commit
450b47fbb0
@@ -87,13 +87,16 @@ def correct_content_path(file, newpath):
|
||||
f.write(new_content)
|
||||
|
||||
|
||||
def copy_file_endswith(endswith, source_dir, target_dir):
|
||||
def copy_file_endswith(endswith, source_dir, target_dir, skip_dir):
|
||||
print(f"Collect {endswith} files {source_dir} -> {target_dir}")
|
||||
|
||||
if not os.path.exists(target_dir):
|
||||
os.makedirs(target_dir)
|
||||
|
||||
for root, _, files in os.walk(source_dir):
|
||||
if skip_dir in root:
|
||||
continue
|
||||
|
||||
for file in files:
|
||||
if file.endswith(endswith):
|
||||
source_file = os.path.join(root, file)
|
||||
@@ -176,8 +179,8 @@ def main():
|
||||
gcov_data_dir.append(dir)
|
||||
os.makedirs(dir)
|
||||
|
||||
copy_file_endswith(".gcno", gcno_dir, dir)
|
||||
copy_file_endswith(".gcda", i, dir)
|
||||
copy_file_endswith(".gcno", gcno_dir, dir, gcov_dir)
|
||||
copy_file_endswith(".gcda", i, dir, gcov_dir)
|
||||
|
||||
# Only copy files
|
||||
if args.only_copy:
|
||||
|
||||
Reference in New Issue
Block a user