tools/code_coverage/coverage.py
def _ParseCommandArguments():
  """Adds and parses relevant arguments for tool comands.

  Returns:
    A dictionary representing the arguments.
  """
  arg_parser = argparse.ArgumentParser()
  arg_parser.usage = __doc__

  arg_parser.add_argument(
      '-b',
      '--build-dir',
      type=str,
      required=True,
      help='The build directory, the path needs to be relative to the root of '
      'the checkout.')

  arg_parser.add_argument(
      '-o',
      '--output-dir',
      type=str,
      required=True,
      help='Output directory for generated artifacts.')

  arg_parser.add_argument(
      '-c',
      '--command',
      action='append',
      required=False,
      help='Commands used to run test targets, one test target needs one and '
      'only one command, when specifying commands, one should assume the '
      'current working directory is the root of the checkout. This option is '
      'incompatible with -p/--profdata-file option.')

  arg_parser.add_argument(
      '-wt',
      '--web-tests',
      nargs='?',
      type=str,
      const=' ',
      required=False,
      help='Run blink web tests. Support passing arguments to run_web_tests.py')

  arg_parser.add_argument(
      '-p',
      '--profdata-file',
      type=str,
      required=False,
      help='Path to profdata file to use for generating code coverage reports. '
      'This can be useful if you generated the profdata file seperately in '
      'your own test harness. This option is ignored if run command(s) are '
      'already provided above using -c/--command option.')

  arg_parser.add_argument(
      '-f',
      '--filters',
      action='append',
      required=False,
      help='Directories or files to get code coverage for, and all files under '
      'the directories are included recursively.')

  arg_parser.add_argument(
      '-i',
      '--ignore-filename-regex',
      type=str,
      help='Skip source code files with file paths that match the given '
      'regular expression. For example, use -i=\'.*/out/.*|.*/third_party/.*\' '
      'to exclude files in third_party/ and out/ folders from the report.')

  arg_parser.add_argument(
      '--no-file-view',
      action='store_true',
      help='Don\'t generate the file view in the coverage report. When there '
      'are large number of html files, the file view becomes heavy and may '
      'cause the browser to freeze, and this argument comes handy.')

  arg_parser.add_argument(
      '--no-component-view',
      action='store_true',
      help='Don\'t generate the component view in the coverage report.')

  arg_parser.add_argument(
      '--coverage-tools-dir',
      type=str,
      help='Path of the directory where LLVM coverage tools (llvm-cov, '
      'llvm-profdata) exist. This should be only needed if you are testing '
      'against a custom built clang revision. Otherwise, we pick coverage '
      'tools automatically from your current source checkout.')

  arg_parser.add_argument(
      '-j',
      '--jobs',
      type=int,
      default=None,
      help='Run N jobs to build in parallel. If not specified, a default value '
      'will be derived based on CPUs and goma availability. Please refer to '
      '\'autoninja -h\' for more details.')

  arg_parser.add_argument(
      '--format',
      type=str,
      default='html',
      help='Output format of the "llvm-cov show/export" command. The '
      'supported formats are "text", "html" and "lcov".')

  arg_parser.add_argument(
      '-v',
      '--verbose',
      action='store_true',
      help='Prints additional output for diagnostics.')

  arg_parser.add_argument(
      '-l', '--log_file', type=str, help='Redirects logs to a file.')

  arg_parser.add_argument(
      'targets',
      nargs='+',
      help='The names of the test targets to run. If multiple run commands are '
      'specified using the -c/--command option, then the order of targets and '
      'commands must match, otherwise coverage generation will fail.')

  args = arg_parser.parse_args()
  return args
Adds and parses relevant arguments for tool comands.

  Returns:
    A dictionary representing the arguments.
  
Adds and parses relevant arguments for tool comands.
Adds and parses relevant arguments for tool comands .
def _ParseCommandArguments():
  arg_parser = argparse.ArgumentParser()
  arg_parser.usage = __doc__
  arg_parser.add_argument(
      '-b',
      '--build-dir',
      type=str,
      required=True,
      help='The build directory, the path needs to be relative to the root of '
      'the checkout.')
  arg_parser.add_argument(
      '-o',
      '--output-dir',
      type=str,
      required=True,
      help='Output directory for generated artifacts.')
  arg_parser.add_argument(
      '-c',
      '--command',
      action='append',
      required=False,
      help='Commands used to run test targets, one test target needs one and '
      'only one command, when specifying commands, one should assume the '
      'current working directory is the root of the checkout. This option is '
      'incompatible with -p/--profdata-file option.')
  arg_parser.add_argument(
      '-wt',
      '--web-tests',
      nargs='?',
      type=str,
      const=' ',
      required=False,
      help='Run blink web tests. Support passing arguments to run_web_tests.py')
  arg_parser.add_argument(
      '-p',
      '--profdata-file',
      type=str,
      required=False,
      help='Path to profdata file to use for generating code coverage reports. '
      'This can be useful if you generated the profdata file seperately in '
      'your own test harness. This option is ignored if run command(s) are '
      'already provided above using -c/--command option.')
  arg_parser.add_argument(
      '-f',
      '--filters',
      action='append',
      required=False,
      help='Directories or files to get code coverage for, and all files under '
      'the directories are included recursively.')
  arg_parser.add_argument(
      '-i',
      '--ignore-filename-regex',
      type=str,
      help='Skip source code files with file paths that match the given '
      'regular expression. For example, use -i=\'.*/out/.*|.*/third_party/.*\' '
      'to exclude files in third_party/ and out/ folders from the report.')
  arg_parser.add_argument(
      '--no-file-view',
      action='store_true',
      help='Don\'t generate the file view in the coverage report. When there '
      'are large number of html files, the file view becomes heavy and may '
      'cause the browser to freeze, and this argument comes handy.')
  arg_parser.add_argument(
      '--no-component-view',
      action='store_true',
      help='Don\'t generate the component view in the coverage report.')
  arg_parser.add_argument(
      '--coverage-tools-dir',
      type=str,
      help='Path of the directory where LLVM coverage tools (llvm-cov, '
      'llvm-profdata) exist. This should be only needed if you are testing '
      'against a custom built clang revision. Otherwise, we pick coverage '
      'tools automatically from your current source checkout.')
  arg_parser.add_argument(
      '-j',
      '--jobs',
      type=int,
      default=None,
      help='Run N jobs to build in parallel. If not specified, a default value '
      'will be derived based on CPUs and goma availability. Please refer to '
      '\'autoninja -h\' for more details.')
  arg_parser.add_argument(
      '--format',
      type=str,
      default='html',
      help='Output format of the "llvm-cov show/export" command. The '
      'supported formats are "text", "html" and "lcov".')
  arg_parser.add_argument(
      '-v',
      '--verbose',
      action='store_true',
      help='Prints additional output for diagnostics.')
  arg_parser.add_argument(
      '-l', '--log_file', type=str, help='Redirects logs to a file.')
  arg_parser.add_argument(
      'targets',
      nargs='+',
      help='The names of the test targets to run. If multiple run commands are '
      'specified using the -c/--command option, then the order of targets and '
      'commands must match, otherwise coverage generation will fail.')
  args = arg_parser.parse_args()
  return args
def _ParseCommandArguments ( ) : arg_parser = argparse . ArgumentParser ( ) arg_parser . usage = __doc__ arg_parser . add_argument ( '-b' , '--build-dir' , type = str , required = True , help = 'The build directory, the path needs to be relative to the root of ' 'the checkout.' ) arg_parser . add_argument ( '-o' , '--output-dir' , type = str , required = True , help = 'Output directory for generated artifacts.' ) arg_parser . add_argument ( '-c' , '--command' , action = 'append' , required = False , help = 'Commands used to run test targets, one test target needs one and ' 'only one command, when specifying commands, one should assume the ' 'current working directory is the root of the checkout. This option is ' 'incompatible with -p/--profdata-file option.' ) arg_parser . add_argument ( '-wt' , '--web-tests' , nargs = '?' , type = str , const = ' ' , required = False , help = 'Run blink web tests. Support passing arguments to run_web_tests.py' ) arg_parser . add_argument ( '-p' , '--profdata-file' , type = str , required = False , help = 'Path to profdata file to use for generating code coverage reports. ' 'This can be useful if you generated the profdata file seperately in ' 'your own test harness. This option is ignored if run command(s) are ' 'already provided above using -c/--command option.' ) arg_parser . add_argument ( '-f' , '--filters' , action = 'append' , required = False , help = 'Directories or files to get code coverage for, and all files under ' 'the directories are included recursively.' ) arg_parser . add_argument ( '-i' , '--ignore-filename-regex' , type = str , help = 'Skip source code files with file paths that match the given ' 'regular expression. For example, use -i=\'.*/out/.*|.*/third_party/.*\' ' 'to exclude files in third_party/ and out/ folders from the report.' ) arg_parser . add_argument ( '--no-file-view' , action = 'store_true' , help = 'Don\'t generate the file view in the coverage report. When there ' 'are large number of html files, the file view becomes heavy and may ' 'cause the browser to freeze, and this argument comes handy.' ) arg_parser . add_argument ( '--no-component-view' , action = 'store_true' , help = 'Don\'t generate the component view in the coverage report.' ) arg_parser . add_argument ( '--coverage-tools-dir' , type = str , help = 'Path of the directory where LLVM coverage tools (llvm-cov, ' 'llvm-profdata) exist. This should be only needed if you are testing ' 'against a custom built clang revision. Otherwise, we pick coverage ' 'tools automatically from your current source checkout.' ) arg_parser . add_argument ( '-j' , '--jobs' , type = int , default = None , help = 'Run N jobs to build in parallel. If not specified, a default value ' 'will be derived based on CPUs and goma availability. Please refer to ' '\'autoninja -h\' for more details.' ) arg_parser . add_argument ( '--format' , type = str , default = 'html' , help = 'Output format of the "llvm-cov show/export" command. The ' 'supported formats are "text", "html" and "lcov".' ) arg_parser . add_argument ( '-v' , '--verbose' , action = 'store_true' , help = 'Prints additional output for diagnostics.' ) arg_parser . add_argument ( '-l' , '--log_file' , type = str , help = 'Redirects logs to a file.' ) arg_parser . add_argument ( 'targets' , nargs = '+' , help = 'The names of the test targets to run. If multiple run commands are ' 'specified using the -c/--command option, then the order of targets and ' 'commands must match, otherwise coverage generation will fail.' ) args = arg_parser . parse_args ( ) return args
Adds and parses relevant arguments for tool comands.
Adds and parses relevant arguments for tool comands .
"""Adds and parses relevant arguments for tool comands.

  Returns:
    A dictionary representing the arguments.
  """
A dictionary representing the arguments.
A dictionary representing the arguments .