Commit 8c3a1ce3 authored by Abhishek Arya's avatar Abhishek Arya Committed by Commit Bot

Coverage: Avoid double-counting of sub-dirs in component view.

TBR=mmoroz@chromium.org,liaoyuke@chromium.org

Change-Id: I7c192d6ef87ff08291574ba3c42aeeb8640d9306
Reviewed-on: https://chromium-review.googlesource.com/1056627Reviewed-by: default avatarAbhishek Arya <inferno@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558153}
parent 06e8f30c
......@@ -674,9 +674,19 @@ def _ExtractComponentToDirectoriesMapping():
directory_to_component = component_mappings['dir-to-component']
component_to_directories = defaultdict(list)
for directory in directory_to_component:
for directory in sorted(directory_to_component):
component = directory_to_component[directory]
component_to_directories[component].append(directory)
# Check if we already added the parent directory of this directory. If yes,
# skip this sub-directory to avoid double-counting.
found_parent_directory = False
for component_directory in component_to_directories[component]:
if directory.startswith(component_directory + '/'):
found_parent_directory = True
break
if not found_parent_directory:
component_to_directories[component].append(directory)
return component_to_directories
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment