Commit e677802c authored by Sajjad Mirza's avatar Sajjad Mirza Committed by Commit Bot

[code coverage] Normalize source file path in compile wrapper.

Paths in `--files-to-instrument` are expected to be normalized OS-native
paths, so the input source file has to be converted to match.

This is most relevant on Windows, where GN creates build commands that
use `/` for filesystem paths, but the canonical form should use `\`.

Bug: 990480
Change-Id: If7b5da729f0a98ec7945092b0f228cebd50be3a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973360
Commit-Queue: Sajjad Mirza <sajjadm@chromium.org>
Reviewed-by: default avatarYuke Liao <liaoyuke@chromium.org>
Reviewed-by: default avatarRoberto Carrillo <robertocn@chromium.org>
Reviewed-by: default avatarNodir Turakulov <nodir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726120}
parent 8058198c
......@@ -152,7 +152,11 @@ def main():
if source_flag_index + 1 >= len(compile_command):
raise Exception('Source file to be compiled is missing from the command.')
compile_source_file = compile_command[source_flag_index + 1]
# On Windows, filesystem paths should use '\', but GN creates build commands
# that use '/'. We invoke os.path.normpath to ensure that the path uses the
# correct separator for the current platform (i.e. '\' on Windows and '/'
# otherwise).
compile_source_file = os.path.normpath(compile_command[source_flag_index + 1])
exclusion_list = _COVERAGE_EXCLUSION_LIST_MAP.get(
target_os, _DEFAULT_COVERAGE_EXCLUSION_LIST)
......
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