Commit 95d13d77 authored by Yuke Liao's avatar Yuke Liao Committed by Commit Bot

[Coverage] Fix a bug in code coverage script.

Fix a bug in the script. The script requires that the target executable
specified in the commands to be relative to the root of the source,
which doesn't make sense, users should be allowed to use whatever path
as long as it points to the right place.

Bug: 
Change-Id: I152797da96d02b9f211dd9e56421ff551e84597c
Reviewed-on: https://chromium-review.googlesource.com/814734
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Reviewed-by: default avatarAbhishek Arya <inferno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522478}
parent f6588405
......@@ -408,17 +408,15 @@ def _IsTargetGTestTarget(target):
return target in GTEST_TARGET_NAMES
def _ValidateCommandsAreRelativeToSrcRoot(commands):
def _VerifyTargetExecutablesAreInBuildDirectory(commands):
"""Verifies that the target executables specified in the commands are inside
the given build directory."""
for command in commands:
binary_path = _GetBinaryPath(command)
assert binary_path.startswith(BUILD_DIR), ('Target executable "%s" is '
'outside of the given build '
'directory: "%s". Please make '
'sure the command: "%s" is '
'relative to the root of the '
'checkout.' %
(binary_path, BUILD_DIR,
command))
binary_absolute_path = os.path.abspath(os.path.normpath(binary_path))
assert binary_absolute_path.startswith(os.path.abspath(BUILD_DIR)), (
'Target executable "%s" in command: "%s" is outside of '
'the given build directory: "%s".' % (binary_path, command, BUILD_DIR))
def _ValidateBuildingWithClangCoverage():
......@@ -553,7 +551,7 @@ def Main():
'Build directory: {} doesn\'t exist. '
'Please run "gn gen" to generate.').format(BUILD_DIR)
_ValidateBuildingWithClangCoverage()
_ValidateCommandsAreRelativeToSrcRoot(args.command)
_VerifyTargetExecutablesAreInBuildDirectory(args.command)
absolute_filter_paths = []
if args.filters:
......
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