testing/libfuzzer/gen_fuzzer_owners.py
def GetOwnersForFuzzer(sources):
  """Return owners given a list of sources as input."""
  if not sources:
    return

  for source in sources:
    full_source_path = os.path.join(CHROMIUM_SRC_DIR, source)
    if not os.path.exists(full_source_path):
      continue

    with open(full_source_path, 'r') as source_file_handle:
      source_content = source_file_handle.read()

    if SubStringExistsIn(
        ['FuzzOneInput', 'LLVMFuzzerTestOneInput', 'PROTO_FUZZER'],
        source_content):
      # Found the fuzzer source (and not dependency of fuzzer).

      git_dir = os.path.join(CHROMIUM_SRC_DIR, '.git')
      git_command = GetGitCommand()
      is_git_file = bool(subprocess.check_output(
          [git_command, '--git-dir', git_dir, 'ls-files', source],
          cwd=CHROMIUM_SRC_DIR))
      if not is_git_file:
        # File is not in working tree. Return owners for third_party.
        return GetOwnersIfThirdParty(full_source_path)

      # git log --follow and --reverse don't work together and using just
      # --follow is too slow. Make a best estimate with an assumption that
      # the original author has authored line 1 which is usually the
      # copyright line and does not change even with file rename / move.
      blame_output = subprocess.check_output(
          [git_command, '--git-dir', git_dir, 'blame', '--porcelain', '-L1,1',
           source], cwd=CHROMIUM_SRC_DIR)
      return GetAuthorFromGitBlame(blame_output)

  return None
Return owners given a list of sources as input.
Return owners given a list of sources as input.
Return owners given a list of sources as input .
def GetOwnersForFuzzer(sources):
  if not sources:
    return
  for source in sources:
    full_source_path = os.path.join(CHROMIUM_SRC_DIR, source)
    if not os.path.exists(full_source_path):
      continue
    with open(full_source_path, 'r') as source_file_handle:
      source_content = source_file_handle.read()
    if SubStringExistsIn(
        ['FuzzOneInput', 'LLVMFuzzerTestOneInput', 'PROTO_FUZZER'],
        source_content):
      git_dir = os.path.join(CHROMIUM_SRC_DIR, '.git')
      git_command = GetGitCommand()
      is_git_file = bool(subprocess.check_output(
          [git_command, '--git-dir', git_dir, 'ls-files', source],
          cwd=CHROMIUM_SRC_DIR))
      if not is_git_file:
        return GetOwnersIfThirdParty(full_source_path)
      blame_output = subprocess.check_output(
          [git_command, '--git-dir', git_dir, 'blame', '--porcelain', '-L1,1',
           source], cwd=CHROMIUM_SRC_DIR)
      return GetAuthorFromGitBlame(blame_output)
  return None
def GetOwnersForFuzzer ( sources ) : if not sources : return for source in sources : full_source_path = os . path . join ( CHROMIUM_SRC_DIR , source ) if not os . path . exists ( full_source_path ) : continue with open ( full_source_path , 'r' ) as source_file_handle : source_content = source_file_handle . read ( ) if SubStringExistsIn ( [ 'FuzzOneInput' , 'LLVMFuzzerTestOneInput' , 'PROTO_FUZZER' ] , source_content ) : git_dir = os . path . join ( CHROMIUM_SRC_DIR , '.git' ) git_command = GetGitCommand ( ) is_git_file = bool ( subprocess . check_output ( [ git_command , '--git-dir' , git_dir , 'ls-files' , source ] , cwd = CHROMIUM_SRC_DIR ) ) if not is_git_file : return GetOwnersIfThirdParty ( full_source_path ) blame_output = subprocess . check_output ( [ git_command , '--git-dir' , git_dir , 'blame' , '--porcelain' , '-L1,1' , source ] , cwd = CHROMIUM_SRC_DIR ) return GetAuthorFromGitBlame ( blame_output ) return None
Return owners given a list of sources as input.
Return owners given a list of sources as input .
"""Return owners given a list of sources as input.""" # Found the fuzzer source (and not dependency of fuzzer). # File is not in working tree. Return owners for third_party. # git log --follow and --reverse don't work together and using just # --follow is too slow. Make a best estimate with an assumption that # the original author has authored line 1 which is usually the # copyright line and does not change even with file rename / move.
sources