Exemple #1
0
def get_impact_on_build(build_type, current_version, testcase,
                        testcase_file_path):
    """Return impact and additional trace on a prod build given build_type."""
    build = build_manager.setup_production_build(build_type)
    if not build:
        raise BuildFailedException('Build setup failed for %s' %
                                   build_type.capitalize())

    app_path = environment.get_value('APP_PATH')
    if not app_path:
        raise AppFailedException()

    version = build.revision
    if version == current_version:
        return Impact(current_version, likely=False)

    command = testcase_manager.get_command_line_for_application(
        testcase_file_path, app_path=app_path, needs_http=testcase.http_flag)
    result = testcase_manager.test_for_crash_with_retries(
        testcase,
        testcase_file_path,
        environment.get_value('TEST_TIMEOUT'),
        http_flag=testcase.http_flag)

    if result.is_crash():
        symbolized_crash_stacktrace = result.get_stacktrace(symbolized=True)
        unsymbolized_crash_stacktrace = result.get_stacktrace(symbolized=False)
        stacktrace = utils.get_crash_stacktrace_output(
            command, symbolized_crash_stacktrace,
            unsymbolized_crash_stacktrace, build_type)
        return Impact(version, likely=False, extra_trace=stacktrace)

    return Impact()
Exemple #2
0
def get_impact_on_build(build_type, current_version, testcase,
                        testcase_file_path):
  """Return impact and additional trace on a prod build given build_type."""
  # TODO(yuanjunh): remove es_enabled var after testing is done.
  es_enabled = testcase.get_metadata('es_enabled', False)
  if build_type == 'extended_stable' and not es_enabled:
    return Impact()
  build = build_manager.setup_production_build(build_type)
  if not build:
    raise BuildFailedException(
        'Build setup failed for %s' % build_type.capitalize())

  if not build_manager.check_app_path():
    raise AppFailedException()

  version = build.revision
  if version == current_version:
    return Impact(current_version, likely=False)

  app_path = environment.get_value('APP_PATH')
  command = testcase_manager.get_command_line_for_application(
      testcase_file_path, app_path=app_path, needs_http=testcase.http_flag)

  if es_enabled:
    logs.log(
        "ES build for testcase %d, command: %s" % (testcase.key.id(), command))

  result = testcase_manager.test_for_crash_with_retries(
      testcase,
      testcase_file_path,
      environment.get_value('TEST_TIMEOUT'),
      http_flag=testcase.http_flag)

  if result.is_crash():
    symbolized_crash_stacktrace = result.get_stacktrace(symbolized=True)
    unsymbolized_crash_stacktrace = result.get_stacktrace(symbolized=False)
    stacktrace = utils.get_crash_stacktrace_output(
        command, symbolized_crash_stacktrace, unsymbolized_crash_stacktrace,
        build_type)
    return Impact(version, likely=False, extra_trace=stacktrace)

  return Impact()