tools/code_coverage/coverage.py
def _GeneratePerFileCoverageSummary(binary_paths, profdata_file_path, filters,
                                    ignore_filename_regex):
  """Generates per file coverage summary using "llvm-cov export" command."""
  # llvm-cov export [options] -instr-profile PROFILE BIN [-object BIN,...]
  # [[-object BIN]] [SOURCES].
  # NOTE: For object files, the first one is specified as a positional argument,
  # and the rest are specified as keyword argument.
  logging.debug('Generating per-file code coverage summary using "llvm-cov '
                'export -summary-only" command.')
  for path in binary_paths:
    if not os.path.exists(path):
      logging.error("Binary %s does not exist", path)
  subprocess_cmd = [
      LLVM_COV_PATH, 'export', '-summary-only',
      '-compilation-dir={}'.format(BUILD_DIR),
      '-instr-profile=' + profdata_file_path, binary_paths[0]
  ]
  subprocess_cmd.extend(
      ['-object=' + binary_path for binary_path in binary_paths[1:]])
  _AddArchArgumentForIOSIfNeeded(subprocess_cmd, len(binary_paths))
  subprocess_cmd.extend(filters)
  if ignore_filename_regex:
    subprocess_cmd.append('-ignore-filename-regex=%s' % ignore_filename_regex)

  export_output = subprocess.check_output(subprocess_cmd)

  # Write output on the disk to be used by code coverage bot.
  with open(_GetSummaryFilePath(), 'wb') as f:
    f.write(export_output)

  return export_output
Generates per file coverage summary using "llvm-cov export" command.
Generates per file coverage summary using "llvm-cov export" command.
Generates per file coverage summary using " llvm - cov export " command .
def _GeneratePerFileCoverageSummary(binary_paths, profdata_file_path, filters,
                                    ignore_filename_regex):
  logging.debug('Generating per-file code coverage summary using "llvm-cov '
                'export -summary-only" command.')
  for path in binary_paths:
    if not os.path.exists(path):
      logging.error("Binary %s does not exist", path)
  subprocess_cmd = [
      LLVM_COV_PATH, 'export', '-summary-only',
      '-compilation-dir={}'.format(BUILD_DIR),
      '-instr-profile=' + profdata_file_path, binary_paths[0]
  ]
  subprocess_cmd.extend(
      ['-object=' + binary_path for binary_path in binary_paths[1:]])
  _AddArchArgumentForIOSIfNeeded(subprocess_cmd, len(binary_paths))
  subprocess_cmd.extend(filters)
  if ignore_filename_regex:
    subprocess_cmd.append('-ignore-filename-regex=%s' % ignore_filename_regex)
  export_output = subprocess.check_output(subprocess_cmd)
  with open(_GetSummaryFilePath(), 'wb') as f:
    f.write(export_output)
  return export_output
def _GeneratePerFileCoverageSummary ( binary_paths , profdata_file_path , filters , ignore_filename_regex ) : logging . debug ( 'Generating per-file code coverage summary using "llvm-cov ' 'export -summary-only" command.' ) for path in binary_paths : if not os . path . exists ( path ) : logging . error ( "Binary %s does not exist" , path ) subprocess_cmd = [ LLVM_COV_PATH , 'export' , '-summary-only' , '-compilation-dir={}' . format ( BUILD_DIR ) , '-instr-profile=' + profdata_file_path , binary_paths [ 0 ] ] subprocess_cmd . extend ( [ '-object=' + binary_path for binary_path in binary_paths [ 1 : ] ] ) _AddArchArgumentForIOSIfNeeded ( subprocess_cmd , len ( binary_paths ) ) subprocess_cmd . extend ( filters ) if ignore_filename_regex : subprocess_cmd . append ( '-ignore-filename-regex=%s' % ignore_filename_regex ) export_output = subprocess . check_output ( subprocess_cmd ) with open ( _GetSummaryFilePath ( ) , 'wb' ) as f : f . write ( export_output ) return export_output
Generates per file coverage summary using "llvm-cov export" command.
Generates per file coverage summary using " llvm - cov export " command .
"""Generates per file coverage summary using "llvm-cov export" command.""" # llvm-cov export [options] -instr-profile PROFILE BIN [-object BIN,...] # [[-object BIN]] [SOURCES]. # NOTE: For object files, the first one is specified as a positional argument, # and the rest are specified as keyword argument. # Write output on the disk to be used by code coverage bot.
binary_paths
profdata_file_path
filters
ignore_filename_regex