Ejemplo n.º 1
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('webkit/tools/layout_tests/run_webkit_tests.py')] + 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)
Ejemplo n.º 2
0
def DeviceStatusCheck(options):
    bb_annotations.PrintNamedStep('device_status_check')
    cmd = ['build/android/buildbot/bb_device_status_check.py']
    if options.restart_usb:
        cmd.append('--restart-usb')
    RunCmd(cmd, halt_on_failure=True)
Ejemplo n.º 3
0
def RunWebkitLint():
    """Lint WebKit's TestExpectation files."""
    bb_annotations.PrintNamedStep('webkit_lint')
    RunCmd(
        [SrcPath(os.path.join(BLINK_SCRIPTS_DIR, 'lint-test-expectations'))])
Ejemplo n.º 4
0
def RunPythonUnitTests(_options):
    for suite in constants.PYTHON_UNIT_TEST_SUITES:
        bb_annotations.PrintNamedStep(suite)
        RunCmd(['build/android/test_runner.py', 'python', '-s', suite])
Ejemplo n.º 5
0
def CheckWebViewLicenses(_):
  bb_annotations.PrintNamedStep('check_licenses')
  RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'],
         warning_code=1)
Ejemplo n.º 6
0
def RunJunitSuite(suite):
    bb_annotations.PrintNamedStep(suite)
    RunCmd(['build/android/test_runner.py', 'junit', '-s', suite])
Ejemplo n.º 7
0
def DownloadWebRTCResources(_):
  bb_annotations.PrintNamedStep('download_resources')
  RunCmd([SrcPath('third_party', 'webrtc', 'tools', 'update_resources.py'),
          '-p', '../../../'], halt_on_failure=True)
Ejemplo n.º 8
0
def ExtractBuild(options):
    bb_annotations.PrintNamedStep('extract_build')
    RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py')] +
           bb_utils.EncodeProperties(options),
           cwd=DIR_BUILD_ROOT)
Ejemplo n.º 9
0
def DeviceStatusCheck(_):
    bb_annotations.PrintNamedStep('device_status_check')
    RunCmd(['build/android/buildbot/bb_device_status_check.py'],
           halt_on_failure=True)
Ejemplo n.º 10
0
def GenerateTestReport(options):
  bb_annotations.PrintNamedStep('test_report')
  for report in glob.glob(
      os.path.join(CHROME_SRC, 'out', options.target, 'test_logs', '*.log')):
    RunCmd(['cat', report])
    os.remove(report)
Ejemplo n.º 11
0
def RunChromeDriverTests(_):
  """Run all the steps for running chromedriver tests."""
  bb_annotations.PrintNamedStep('chromedriver_annotation')
  RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py',
          '--android-package=%s' % constants.CHROMIUM_TEST_SHELL_PACKAGE])