Ejemplo n.º 1
0
def execute(testcase_id, current, build):
    """Execute the reproduce command."""

    print 'Reproduce %s (current=%s)' % (testcase_id, current)
    print 'Downloading testcase information...'

    response = get_testcase_info(testcase_id)
    goma_dir = ensure_goma()
    current_testcase = testcase.Testcase(response)

    definition = get_binary_definition(current_testcase.job_type, build)

    maybe_warn_unreproducible(current_testcase)

    if build == 'download':
        if definition.binary_name:
            binary_name = definition.binary_name
        else:
            binary_name = common.get_binary_name(
                current_testcase.stacktrace_lines)
        binary_provider = binary_providers.DownloadedBinary(
            current_testcase.id, current_testcase.build_url, binary_name)
    else:
        binary_provider = definition.builder(  # pylint: disable=redefined-variable-type
            current_testcase, definition, current, goma_dir)

    reproduce_crash(binary_provider.get_binary_path(),
                    binary_provider.symbolizer_path, current_testcase,
                    definition.sanitizer)

    maybe_warn_unreproducible(current_testcase)
def build_base_testcase(stacktrace_lines=None,
                        revision=None,
                        build_url=None,
                        window_arg='',
                        minimized_args='',
                        extension='js'):
    """Builds a testcase instance that can be used for testing."""
    if extension is not None:
        extension = '.%s' % extension
    else:
        extension = ''
    if stacktrace_lines is None:
        stacktrace_lines = []
    testcase_json = {
        'id': '12345',
        'crash_stacktrace': {
            'lines': stacktrace_lines
        },
        'crash_revision': revision,
        'metadata': {
            'build_url': build_url
        },
        'testcase': {
            'window_argument': window_arg,
            'job_type': 'linux_asan_d8_dbg',
            'one_time_crasher_flag': False,
            'minimized_arguments': minimized_args,
            'absolute_path': '/absolute/path%s' % extension
        }
    }

    return testcase.Testcase(testcase_json)
Ejemplo n.º 3
0
def execute(testcase_id, current, download):
  """Execute the reproduce command."""

  print 'Reproduce %s (current=%s)' % (testcase_id, current)
  print 'Downloading testcase information...'

  response = get_testcase_info(testcase_id)
  goma_dir = ensure_goma()
  current_testcase = testcase.Testcase(response)

  if download:
    binary_provider = binary_providers.V8DownloadedBinary(
        current_testcase.id, current_testcase.build_url)
  else:
    binary_provider = binary_providers.V8Builder( # pylint: disable=redefined-variable-type
        current_testcase.id, current_testcase.build_url,
        current_testcase.revision, current, goma_dir, os.environ.get('V8_SRC'))

  reproduce_crash(binary_provider.get_binary_path(), current_testcase)
Ejemplo n.º 4
0
def make_testcase(
    testcase_id='1',
    stacktrace_lines='a\nb\nc\n',
    environment=None,
    reproduction_args='--args',
    revision=12345,
    build_url='build_url',
    job_type='job_type',
    absolute_path='absolute_path.html',
    reproducible=True,
    gestures='gestures',
    crash_type='type',
    crash_state='state1\nstate2',
    raw_gn_args='a=b\nc=d',
    files=None,
    command_line_file_path=None,
    android_package_name=None,
    android_main_class_name=None,
    created_at=100,
    platform='linux'):
  """Make a testcase."""
  if files is None:
    files = {'test.conf': 'test-conf-content'}
  return testcase.Testcase(
      testcase_id=testcase_id,
      stacktrace_lines=stacktrace_lines,
      environment=(environment or {}),
      reproduction_args=reproduction_args,
      revision=revision,
      build_url=build_url,
      job_type=job_type,
      absolute_path=absolute_path,
      reproducible=reproducible,
      gestures=gestures,
      crash_type=crash_type,
      crash_state=crash_state,
      raw_gn_args=raw_gn_args,
      files=files,
      command_line_file_path=command_line_file_path,
      android_package_name=android_package_name,
      android_main_class_name=android_main_class_name,
      created_at=created_at,
      platform=platform)
Ejemplo n.º 5
0
def execute(testcase_id, current, build, disable_goma, j, iterations,
            disable_xvfb, target_args, edit_mode):
    """Execute the reproduce command."""
    logger.info('----- START -----')
    logger.info('Reproducing testcase %s', testcase_id)
    logger.debug(
        '  testcase_id: %s\n  current: %s\n  build: %s\n  disable_goma: %s',
        testcase_id, current, build, disable_goma)
    logger.info('Downloading testcase information...')

    response = get_testcase_info(testcase_id)
    current_testcase = testcase.Testcase(response)

    if 'gestures' in response['testcase']:
        logger.info(
            ('Warning: testcases using gestures are still in development '
             'and are not guaranteed to reproduce correctly.'))

    definition = get_binary_definition(current_testcase.job_type, build)

    maybe_warn_unreproducible(current_testcase)

    if build == 'download':
        if definition.binary_name:
            binary_name = definition.binary_name
        else:
            binary_name = common.get_binary_name(
                current_testcase.stacktrace_lines)
        binary_provider = binary_providers.DownloadedBinary(
            current_testcase.id, current_testcase.build_url, binary_name)
    else:
        goma_dir = None if disable_goma else ensure_goma()
        binary_provider = definition.builder(  # pylint: disable=redefined-variable-type
            current_testcase, definition, current, goma_dir, j, edit_mode)

    reproducer = definition.reproducer(binary_provider, current_testcase,
                                       definition.sanitizer, disable_xvfb,
                                       target_args, edit_mode)
    try:
        reproducer.reproduce(iterations)
    finally:
        maybe_warn_unreproducible(current_testcase)
Ejemplo n.º 6
0
def build_base_testcase(stacktrace_lines=None,
                        revision=None,
                        build_url=None,
                        window_arg='',
                        minimized_args=''):
    """Builds a testcase instance that can be used for testing."""
    if stacktrace_lines is None:
        stacktrace_lines = []
    testcase_json = {
        'id': '12345',
        'crash_stacktrace': {
            'lines': stacktrace_lines
        },
        'crash_revision': revision,
        'metadata': {
            'build_url': build_url
        },
        'testcase': {
            'window_argument': window_arg,
            'minimized_arguments': minimized_args
        }
    }

    return testcase.Testcase(testcase_json)
Ejemplo n.º 7
0
def execute(testcase_id,
            current,
            build,
            disable_goma,
            goma_threads,
            iterations,
            disable_xvfb,
            target_args,
            edit_mode,
            disable_gclient,
            enable_debug,
            goma_dir=None):
    """Execute the reproduce command."""
    options = common.Options(testcase_id=testcase_id,
                             current=current,
                             build=build,
                             disable_goma=disable_goma,
                             goma_threads=goma_threads,
                             iterations=iterations,
                             disable_xvfb=disable_xvfb,
                             target_args=target_args,
                             edit_mode=edit_mode,
                             disable_gclient=disable_gclient,
                             enable_debug=enable_debug,
                             goma_dir=goma_dir)

    logger.info('Reproducing testcase %s', testcase_id)
    logger.debug('%s', str(options))
    logger.info('Downloading testcase information...')

    response = get_testcase_info(testcase_id)
    current_testcase = testcase.Testcase(response)

    if 'gestures' in response['testcase']:
        logger.info(
            common.colorize(
                'Warning: the testcase is using gestures and inherently flaky. '
                "Therefore, we cannot guaranteed that it'll reproduce correctly.",
                common.BASH_YELLOW_MARKER))

    definition = get_definition(current_testcase.job_type, build)

    maybe_warn_unreproducible(current_testcase)

    if build == 'download':
        if definition.binary_name:
            binary_name = definition.binary_name
        else:
            binary_name = common.get_binary_name(
                current_testcase.stacktrace_lines)
        binary_provider = binary_providers.DownloadedBinary(
            testcase_id=current_testcase.id,
            build_url=current_testcase.build_url,
            binary_name=binary_name)
    else:
        options.goma_dir = None if options.disable_goma else ensure_goma()
        binary_provider = definition.builder(testcase=current_testcase,
                                             definition=definition,
                                             options=options)

    reproducer = definition.reproducer(definition=definition,
                                       binary_provider=binary_provider,
                                       testcase=current_testcase,
                                       sanitizer=definition.sanitizer,
                                       options=options)
    try:
        reproducer.reproduce(iterations)
    finally:
        maybe_warn_unreproducible(current_testcase)
Ejemplo n.º 8
0
def execute(testcase_id,
            current,
            build,
            disable_goma,
            goma_threads,
            goma_load,
            iterations,
            disable_xvfb,
            target_args,
            edit_mode,
            skip_deps,
            enable_debug,
            goma_dir=None):
    """Execute the reproduce command."""
    options = common.Options(testcase_id=testcase_id,
                             current=current,
                             build=build,
                             disable_goma=disable_goma,
                             goma_threads=goma_threads,
                             goma_load=goma_load,
                             iterations=iterations,
                             disable_xvfb=disable_xvfb,
                             target_args=target_args,
                             edit_mode=edit_mode,
                             skip_deps=skip_deps,
                             enable_debug=enable_debug,
                             goma_dir=goma_dir)

    logger.info('Reproducing testcase %s', testcase_id)
    logger.debug('%s', str(options))
    logger.info('Downloading testcase information...')

    response = get_testcase_info(testcase_id)
    current_testcase = testcase.Testcase(response)

    definition = get_definition(current_testcase.job_type, build)

    warn_unreproducible_if_needed(current_testcase)

    if build == 'download':
        if definition.binary_name:
            binary_name = definition.binary_name
        else:
            binary_name = common.get_binary_name(
                current_testcase.stacktrace_lines)
        binary_provider = binary_providers.DownloadedBinary(
            testcase_id=current_testcase.id,
            build_url=current_testcase.build_url,
            binary_name=binary_name)
    else:
        options.goma_dir = None if options.disable_goma else ensure_goma()
        binary_provider = definition.builder(testcase=current_testcase,
                                             definition=definition,
                                             options=options)

    reproducer = definition.reproducer(definition=definition,
                                       binary_provider=binary_provider,
                                       testcase=current_testcase,
                                       sanitizer=definition.sanitizer,
                                       options=options)
    try:
        reproducer.reproduce(iterations)
    finally:
        warn_unreproducible_if_needed(current_testcase)