def UploadHTML(options,
               gs_base_dir,
               dir_to_upload,
               link_text,
               link_rel_path='index.html',
               gs_url=GS_URL):
    """Uploads directory at |dir_to_upload| to Google Storage and output a link.

  Args:
    options: Command line options.
    gs_base_dir: The Google Storage base directory (e.g.
      'chromium-code-coverage/java')
    dir_to_upload: Absolute path to the directory to be uploaded.
    link_text: Link text to be displayed on the step.
    link_rel_path: Link path relative to |dir_to_upload|.
    gs_url: Google storage URL.
  """
    revision = _GetRevision(options)
    bot_id = options.build_properties.get('buildername', 'testing')
    randhash = hashlib.sha1(str(random.random())).hexdigest()
    gs_path = '%s/%s/%s/%s' % (gs_base_dir, bot_id, revision, randhash)
    RunCmd(
        [bb_utils.GSUTIL_PATH, 'cp', '-R', dir_to_upload,
         'gs://%s' % gs_path])
    bb_annotations.PrintLink(link_text,
                             '%s/%s/%s' % (gs_url, gs_path, link_rel_path))
Exemplo n.º 2
0
def LogcatDump(options):
  # Print logcat, kill logcat monitor
  bb_annotations.PrintNamedStep('logcat_dump')
  logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log.txt')
  RunCmd([SrcPath('build' , 'android', 'adb_logcat_printer.py'),
          '--output-path', logcat_file, LOGCAT_DIR])
  gs_path = MakeGSPath(options, 'chromium-android/logcat_dumps')
  RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-z', 'txt', logcat_file,
          'gs://%s' % gs_path])
  bb_annotations.PrintLink('logcat dump', '%s/%s' % (GS_AUTH_URL, gs_path))
Exemplo n.º 3
0
def _PrintDashboardLink(link_text, tests, max_tests):
    """Add a link to the flakiness dashboard in the step annotations."""
    if len(tests) > max_tests:
        test_list_text = ' '.join(tests[:max_tests]) + ' and more'
    else:
        test_list_text = ' '.join(tests)

    dashboard_base = ('http://test-results.appspot.com'
                      '/dashboards/flakiness_dashboard.html#'
                      'master=ChromiumWebkit&tests=')

    bb_annotations.PrintLink(
        '%d %s: %s' % (len(tests), link_text, test_list_text),
        dashboard_base + ','.join(tests))
Exemplo n.º 4
0
def UploadHTML(options, gs_base_dir, dir_to_upload, link_text,
               link_rel_path='index.html', gs_url=GS_URL):
  """Uploads directory at |dir_to_upload| to Google Storage and output a link.

  Args:
    options: Command line options.
    gs_base_dir: The Google Storage base directory (e.g.
      'chromium-code-coverage/java')
    dir_to_upload: Absolute path to the directory to be uploaded.
    link_text: Link text to be displayed on the step.
    link_rel_path: Link path relative to |dir_to_upload|.
    gs_url: Google storage URL.
  """
  gs_path = MakeGSPath(options, gs_base_dir)
  RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-R', dir_to_upload, 'gs://%s' % gs_path])
  bb_annotations.PrintLink(link_text,
                           '%s/%s/%s' % (gs_url, gs_path, link_rel_path))
Exemplo n.º 5
0
def RunWebkitLayoutTests(options):
    """Run layout tests on an actual device."""
    bb_annotations.PrintNamedStep('webkit_tests')
    cmd_args = [
        '--no-show-results',
        '--no-new-test-results',
        '--full-results-html',
        '--clobber-old-results',
        '--exit-after-n-failures',
        '5000',
        '--exit-after-n-crashes-or-timeouts',
        '100',
        '--debug-rwt-logging',
        '--results-directory',
        '../layout-test-results',
        '--target',
        options.target,
        '--builder-name',
        options.build_properties.get('buildername', ''),
        '--build-number',
        str(options.build_properties.get('buildnumber', '')),
        '--master-name',
        'ChromiumWebkit',  # TODO: Get this from the cfg.
        '--build-name',
        options.build_properties.get('buildername', ''),
        '--platform=android'
    ]

    for flag in 'test_results_server', 'driver_name', 'additional_drt_flag':
        if flag in options.factory_properties:
            cmd_args.extend([
                '--%s' % flag.replace('_', '-'),
                options.factory_properties.get(flag)
            ])

    for f in options.factory_properties.get('additional_expectations', []):
        cmd_args.extend([
            '--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)
        ])

    # TODO(dpranke): Remove this block after
    # https://codereview.chromium.org/12927002/ lands.
    for f in options.factory_properties.get('additional_expectations_files',
                                            []):
        cmd_args.extend([
            '--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)
        ])

    exit_code = RunCmd(
        [SrcPath(os.path.join(BLINK_SCRIPTS_DIR, 'run-webkit-tests'))] +
        cmd_args)
    if exit_code == 255:  # test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
        bb_annotations.PrintMsg('?? (crashed or hung)')
    elif exit_code == 254:  # test_run_results.NO_DEVICES_EXIT_STATUS
        bb_annotations.PrintMsg('?? (no devices found)')
    elif exit_code == 253:  # test_run_results.NO_TESTS_EXIT_STATUS
        bb_annotations.PrintMsg('?? (no tests found)')
    else:
        full_results_path = os.path.join('..', 'layout-test-results',
                                         'full_results.json')
        if os.path.exists(full_results_path):
            full_results = json.load(open(full_results_path))
            unexpected_passes, unexpected_failures, unexpected_flakes = (
                _ParseLayoutTestResults(full_results))
            if unexpected_failures:
                _PrintDashboardLink('failed',
                                    unexpected_failures,
                                    max_tests=25)
            elif unexpected_passes:
                _PrintDashboardLink('unexpected passes',
                                    unexpected_passes,
                                    max_tests=10)
            if unexpected_flakes:
                _PrintDashboardLink('unexpected flakes',
                                    unexpected_flakes,
                                    max_tests=10)

            if exit_code == 0 and (unexpected_passes or unexpected_flakes):
                # If exit_code != 0, RunCmd() will have already printed an error.
                bb_annotations.PrintWarning()
        else:
            bb_annotations.PrintError()
            bb_annotations.PrintMsg('?? (results missing)')

    if options.factory_properties.get('archive_webkit_results', False):
        bb_annotations.PrintNamedStep('archive_webkit_results')
        base = 'https://storage.googleapis.com/chromium-layout-test-archives'
        builder_name = options.build_properties.get('buildername', '')
        build_number = str(options.build_properties.get('buildnumber', ''))
        results_link = '%s/%s/%s/layout-test-results/results.html' % (
            base, EscapeBuilderName(builder_name), build_number)
        bb_annotations.PrintLink('results', results_link)
        bb_annotations.PrintLink(
            '(zip)', '%s/%s/%s/layout-test-results.zip' %
            (base, EscapeBuilderName(builder_name), build_number))
        gs_bucket = 'gs://chromium-layout-test-archives'
        RunCmd([
            os.path.join(SLAVE_SCRIPTS_DIR, 'chromium',
                         'archive_layout_test_results.py'), '--results-dir',
            '../../layout-test-results', '--build-number', build_number,
            '--builder-name', builder_name, '--gs-bucket', gs_bucket
        ],
               cwd=DIR_BUILD_ROOT)
Exemplo n.º 6
0
def RunWebkitLayoutTests(options):
    """Run layout tests on an actual device."""
    bb_annotations.PrintNamedStep('webkit_tests')
    cmd_args = [
        '--no-show-results',
        '--no-new-test-results',
        '--full-results-html',
        '--clobber-old-results',
        '--exit-after-n-failures',
        '5000',
        '--exit-after-n-crashes-or-timeouts',
        '100',
        '--debug-rwt-logging',
        '--results-directory',
        '../layout-test-results',
        '--target',
        options.target,
        '--builder-name',
        options.build_properties.get('buildername', ''),
        '--build-number',
        str(options.build_properties.get('buildnumber', '')),
        '--master-name',
        'ChromiumWebkit',  # TODO: Get this from the cfg.
        '--build-name',
        options.build_properties.get('buildername', ''),
        '--platform=android'
    ]

    for flag in 'test_results_server', 'driver_name', 'additional_drt_flag':
        if flag in options.factory_properties:
            cmd_args.extend([
                '--%s' % flag.replace('_', '-'),
                options.factory_properties.get(flag)
            ])

    for f in options.factory_properties.get('additional_expectations', []):
        cmd_args.extend([
            '--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)
        ])

    # TODO(dpranke): Remove this block after
    # https://codereview.chromium.org/12927002/ lands.
    for f in options.factory_properties.get('additional_expectations_files',
                                            []):
        cmd_args.extend([
            '--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)
        ])

    RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args)

    if options.factory_properties.get('archive_webkit_results', False):
        bb_annotations.PrintNamedStep('archive_webkit_results')
        base = 'https://storage.googleapis.com/chromium-layout-test-archives'
        builder_name = options.build_properties.get('buildername', '')
        build_number = str(options.build_properties.get('buildnumber', ''))
        bb_annotations.PrintLink(
            'results', '%s/%s/%s/layout-test-results/results.html' %
            (base, EscapeBuilderName(builder_name), build_number))
        bb_annotations.PrintLink(
            '(zip)', '%s/%s/%s/layout-test-results.zip' %
            (base, EscapeBuilderName(builder_name), build_number))
        gs_bucket = 'gs://chromium-layout-test-archives'
        RunCmd([
            os.path.join(SLAVE_SCRIPTS_DIR, 'chromium',
                         'archive_layout_test_results.py'), '--results-dir',
            '../../layout-test-results', '--build-dir', CHROME_OUT_DIR,
            '--build-number', build_number, '--builder-name', builder_name,
            '--gs-bucket', gs_bucket
        ])