Beispiel #1
0
def main():
    custom_handler = logging.StreamHandler(sys.stdout)
    custom_handler.setFormatter(run_tests_helper.CustomFormatter())
    logging.getLogger().addHandler(custom_handler)
    logging.getLogger().setLevel(logging.INFO)

    parser = optparse.OptionParser()
    parser.add_option('--device',
                      help='The serial number of the device. If not specified '
                      'will use all devices.')
    parser.add_option('--blacklist-file', help='Device blacklist JSON file.')
    parser.add_option(
        '-a',
        '--all-tombstones',
        action='store_true',
        help="""Resolve symbols for all tombstones, rather than just
                         the most recent""")
    parser.add_option('-s',
                      '--stack',
                      action='store_true',
                      help='Also include symbols for stack data')
    parser.add_option('-w',
                      '--wipe-tombstones',
                      action='store_true',
                      help='Erase all tombstones from device after processing')
    parser.add_option('-j',
                      '--jobs',
                      type='int',
                      default=4,
                      help='Number of jobs to use when processing multiple '
                      'crash stacks.')
    parser.add_option('--output-directory',
                      help='Path to the root build directory.')
    options, _ = parser.parse_args()

    devil_chromium.Initialize()

    blacklist = (device_blacklist.Blacklist(options.blacklist_file)
                 if options.blacklist_file else None)

    if options.output_directory:
        constants.SetOutputDirectory(options.output_directory)
    # Do an up-front test that the output directory is known.
    constants.CheckOutputDirectory()

    if options.device:
        devices = [device_utils.DeviceUtils(options.device)]
    else:
        devices = device_utils.DeviceUtils.HealthyDevices(blacklist)

    # This must be done serially because strptime can hit a race condition if
    # used for the first time in a multithreaded environment.
    # http://bugs.python.org/issue7980
    tombstones = []
    for device in devices:
        tombstones += _GetTombstonesForDevice(device, options)

    _ResolveTombstones(options.jobs, tombstones)
Beispiel #2
0
def ProcessCommonOptions(args):
    """Processes and handles all common options."""
    run_tests_helper.SetLogLevel(args.verbose_count, add_handler=False)
    handler = logging_utils.ColorStreamHandler()
    handler.setFormatter(run_tests_helper.CustomFormatter())
    logging.getLogger().addHandler(handler)

    constants.SetBuildType(args.build_type)
    if args.output_directory:
        constants.SetOutputDirectory(args.output_directory)
Beispiel #3
0
def main():
  custom_handler = logging.StreamHandler(sys.stdout)
  custom_handler.setFormatter(run_tests_helper.CustomFormatter())
  logging.getLogger().addHandler(custom_handler)
  logging.getLogger().setLevel(logging.INFO)

  parser = argparse.ArgumentParser()
  parser.add_argument('--device',
                      help='The serial number of the device. If not specified '
                           'will use all devices.')
  parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
  parser.add_argument('-a', '--all-tombstones', action='store_true',
                      help='Resolve symbols for all tombstones, rather than '
                           'just the most recent.')
  parser.add_argument('-s', '--stack', action='store_true',
                      help='Also include symbols for stack data')
  parser.add_argument('-w', '--wipe-tombstones', action='store_true',
                      help='Erase all tombstones from device after processing')
  parser.add_argument('-j', '--jobs', type=int,
                      default=4,
                      help='Number of jobs to use when processing multiple '
                           'crash stacks.')
  parser.add_argument('--output-directory',
                      help='Path to the root build directory.')
  parser.add_argument('--adb-path', type=os.path.abspath,
                      help='Path to the adb binary.')
  args = parser.parse_args()

  devil_chromium.Initialize(adb_path=args.adb_path)

  blacklist = (device_blacklist.Blacklist(args.blacklist_file)
               if args.blacklist_file
               else None)

  if args.output_directory:
    constants.SetOutputDirectory(args.output_directory)
  # Do an up-front test that the output directory is known.
  constants.CheckOutputDirectory()

  if args.device:
    devices = [device_utils.DeviceUtils(args.device)]
  else:
    devices = device_utils.DeviceUtils.HealthyDevices(blacklist)

  # This must be done serially because strptime can hit a race condition if
  # used for the first time in a multithreaded environment.
  # http://bugs.python.org/issue7980
  for device in devices:
    resolved_tombstones = ResolveTombstones(
        device, args.all_tombstones,
        args.stack, args.wipe_tombstones, args.jobs)
    for line in resolved_tombstones:
      logging.info(line)
Beispiel #4
0
def ProcessCommonOptions(args):
    """Processes and handles all common options."""
    run_tests_helper.SetLogLevel(args.verbose_count, add_handler=False)
    # pylint: disable=redefined-variable-type
    if args.verbose_count > 0:
        handler = logging_utils.ColorStreamHandler()
    else:
        handler = logging.StreamHandler(sys.stdout)
    # pylint: enable=redefined-variable-type
    handler.setFormatter(run_tests_helper.CustomFormatter())
    logging.getLogger().addHandler(handler)

    constants.SetBuildType(args.build_type)
    if args.output_directory:
        constants.SetOutputDirectory(args.output_directory)