Commit 754ce409 authored by Abhishek Arya's avatar Abhishek Arya Committed by Commit Bot

Fix fuzzer owner file creation.

ninja runs gen_fuzzer_owners.py from build directory and
not chromium source root. This causes script to fail to
find owners since it checks source file from incorrect
relative location.
This regressed in
https://chromium.googlesource.com/chromium/src/+/3fb53cf0d187b9537160ad967975f17641d59c1f

R=mmoroz@chromium.org

Bug: 890352
Change-Id: Ib14884f294eadeaa87d08cd57062bf41d63f002e
Reviewed-on: https://chromium-review.googlesource.com/1252003Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595129}
parent e743aab0
...@@ -59,10 +59,11 @@ def GetOwnersForFuzzer(sources): ...@@ -59,10 +59,11 @@ def GetOwnersForFuzzer(sources):
return return
for source in sources: for source in sources:
if not os.path.exists(source): full_source_path = os.path.join(CHROMIUM_SRC_DIR, source)
if not os.path.exists(full_source_path):
continue continue
with open(source, 'r') as source_file_handle: with open(full_source_path, 'r') as source_file_handle:
source_content = source_file_handle.read() source_content = source_file_handle.read()
if SubStringExistsIn( if SubStringExistsIn(
...@@ -72,10 +73,11 @@ def GetOwnersForFuzzer(sources): ...@@ -72,10 +73,11 @@ def GetOwnersForFuzzer(sources):
git_dir = os.path.join(CHROMIUM_SRC_DIR, '.git') git_dir = os.path.join(CHROMIUM_SRC_DIR, '.git')
is_git_file = bool(subprocess.check_output( is_git_file = bool(subprocess.check_output(
['git', '--git-dir', git_dir, 'ls-files', source])) ['git', '--git-dir', git_dir, 'ls-files', source],
cwd=CHROMIUM_SRC_DIR))
if not is_git_file: if not is_git_file:
# File is not in working tree. Return owners for third_party. # File is not in working tree. Return owners for third_party.
return GetOwnersIfThirdParty(source) return GetOwnersIfThirdParty(full_source_path)
# git log --follow and --reverse don't work together and using just # git log --follow and --reverse don't work together and using just
# --follow is too slow. Make a best estimate with an assumption that # --follow is too slow. Make a best estimate with an assumption that
...@@ -83,7 +85,8 @@ def GetOwnersForFuzzer(sources): ...@@ -83,7 +85,8 @@ def GetOwnersForFuzzer(sources):
# copyright line and does not change even with file rename / move. # copyright line and does not change even with file rename / move.
blame_output = subprocess.check_output( blame_output = subprocess.check_output(
['git', '--git-dir', git_dir, ['git', '--git-dir', git_dir,
'blame', '--porcelain', '-L1,1', source]) 'blame', '--porcelain', '-L1,1', source],
cwd=CHROMIUM_SRC_DIR)
return GetAuthorFromGitBlame(blame_output) return GetAuthorFromGitBlame(blame_output)
return None return None
......
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