def main_run(args):
    with common.temporary_file() as tempfile_path:
        rc = common.run_command([
            'vpython',
            os.path.join(common.SRC_DIR, 'testing', 'test_env.py'),
            os.path.join(common.SRC_DIR, 'tools', 'metrics',
                         'metrics_python_tests.py'),
            '--isolated-script-test-output',
            tempfile_path,
            '--skip-set-lpac-acls=1',
        ],
                                cwd=os.path.join(common.SRC_DIR, 'out',
                                                 args.build_config_fs))

        with open(tempfile_path) as f:
            isolated_results = json.load(f)

    results = common.parse_common_test_results(isolated_results,
                                               test_separator='.')

    failures = [
        '%s: %s' % (k, v) for k, v in results['unexpected_failures'].items()
    ]
    common.record_local_script_results('metrics_python_tests', args.output,
                                       failures, True)

    return rc
def main_run(args):
    annotations_file = tempfile.NamedTemporaryFile()
    annotations_filename = annotations_file.name
    annotations_file.close()

    command_line = [
        sys.executable,
        os.path.join(common.SRC_DIR, 'tools', 'traffic_annotation', 'scripts',
                     'traffic_annotation_auditor_tests.py'),
        '--build-path',
        os.path.join(args.paths['checkout'], 'out', args.build_config_fs),
        '--annotations-file',
        annotations_filename,
    ]
    rc = common.run_command(command_line)

    # Update the Google Sheets on success, but only on the Windows trybot.
    if rc == 0 and is_windows():
        print("Tests succeeded. Updating annotations sheet...")

        config_file = tempfile.NamedTemporaryFile(delete=False)
        json.dump(SHEET_CONFIG, config_file, indent=4)
        config_filename = config_file.name
        config_file.close()

        command_line = [
            'vpython.bat',
            os.path.join(common.SRC_DIR, 'tools', 'traffic_annotation',
                         'scripts', 'update_annotations_sheet.py'),
            '--force',
            '--config-file',
            config_filename,
            '--annotations-file',
            annotations_filename,
        ]
        rc = common.run_command(command_line)

        try:
            os.remove(config_filename)
        except OSError:
            pass

    try:
        os.remove(annotations_filename)
    except OSError:
        pass

    failures = ['Please refer to stdout for errors.'] if rc else []
    common.record_local_script_results('test_traffic_annotation_auditor',
                                       args.output, failures, True)

    return rc
def main_run(args):
    """Runs the variations smoke tests."""
    logging.basicConfig(level=logging.INFO)
    parser = argparse.ArgumentParser()
    parser.add_argument('--isolated-script-test-output', type=str)
    args, _ = parser.parse_known_args()
    rc = _run_tests()
    if args.isolated_script_test_output:
        with open(args.isolated_script_test_output, 'w') as f:
            common.record_local_script_results('run_variations_smoke_tests', f,
                                               [], rc == 0)

    return rc
示例#4
0
def main_run(args):
    with common.temporary_file() as tempfile_path:
        rc = common.run_command([
            sys.executable,
            os.path.join(common.SRC_DIR, 'third_party', 'blink', 'tools',
                         'lint_test_expectations.py'), '--json', tempfile_path
        ])

        with open(tempfile_path) as f:
            failures = json.load(f)

    common.record_local_script_results('blink_lint_expectations', args.output,
                                       failures, True)

    return rc
示例#5
0
def main_run(args):
    command_line = [
        sys.executable,
        os.path.join(common.SRC_DIR, 'tools', 'traffic_annotation', 'scripts',
                     'check_annotations.py'),
        '--build-path',
        os.path.join(args.paths['checkout'], 'out', args.build_config_fs),
    ]
    rc = common.run_command(command_line)

    failures = ['Please refer to stdout for errors.'] if rc else []
    common.record_local_script_results('check_network_annotations',
                                       args.output, failures, True)

    return rc
示例#6
0
def main_run(args):
    print(sys.executable)
    with common.temporary_file() as tempfile_path:
        rc = common.run_command([
            with_python3(),
            os.path.join(common.SRC_DIR, 'tools', 'checkbins', 'checkbins.py'),
            '--verbose',
            '--json',
            tempfile_path,
            os.path.join(args.paths['checkout'], 'out', args.build_config_fs),
        ])

        with open(tempfile_path) as f:
            checkbins_results = json.load(f)

    common.record_local_script_results('checkbins', args.output,
                                       checkbins_results, True)

    return rc
示例#7
0
def main_run(args):
  with common.temporary_file() as tempfile_path:
    rc = common.run_command([
        os.path.join(common.SRC_DIR, 'tools', 'checkperms', 'checkperms.py'),
        '--root', args.paths['checkout'],
        '--json', tempfile_path
    ])

    with open(tempfile_path) as f:
      checkperms_results = json.load(f)

  result_set = set()
  for result in checkperms_results:
    result_set.add((result['rel_path'], result['error']))

  failures = ['%s: %s' % (r[0], r[1]) for r in result_set]
  common.record_local_script_results(
      'checkperms', args.output, failures, True)

  return rc
示例#8
0
def main_run(args):
    with common.temporary_file() as tempfile_path:
        rc = common.run_command([
            os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps',
                         'checkdeps.py'), '--json', tempfile_path
        ])

        with open(tempfile_path) as f:
            checkdeps_results = json.load(f)

    result_set = set()
    for result in checkdeps_results:
        for violation in result['violations']:
            result_set.add(
                (result['dependee_path'], violation['include_path']))

    failures = ['%s: %s' % (r[0], r[1]) for r in result_set]
    common.record_local_script_results('checkdeps', args.output, failures,
                                       True)

    return rc
示例#9
0
def main_run(args):
    if args.build_config_fs != 'Release':
        raise Exception('Only release builds are supported')

    src_dir = args.paths['checkout']
    build_dir = os.path.join(src_dir, 'out', args.build_config_fs)
    os.chdir(build_dir)

    if sys.platform.startswith('darwin'):
        rc = main_mac(src_dir,
                      allow_coverage_initializer='--allow-coverage-initializer'
                      in args.args)
    elif sys.platform == 'linux2':
        is_chromeos = 'buildername' in args.properties and \
            'chromeos' in args.properties['buildername']
        rc = main_linux(src_dir, is_chromeos)
    else:
        sys.stderr.write('Unsupported platform %s.\n' % repr(sys.platform))
        return 2

    common.record_local_script_results('check_static_initializers',
                                       args.output, [], rc == 0)

    return rc
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument('--isolated-script-test-output',
                        type=str,
                        required=False)
    parser.add_argument('--isolated-script-test-chartjson-output',
                        type=str,
                        required=False)
    parser.add_argument('--isolated-script-test-perf-output',
                        type=str,
                        required=False)
    parser.add_argument('--isolated-script-test-filter',
                        type=str,
                        required=False)
    parser.add_argument('--platform',
                        type=str,
                        default=sys.platform,
                        required=False)

    args = parser.parse_args(argv)

    env = os.environ.copy()
    # Assume we want to set up the sandbox environment variables all the
    # time; doing so is harmless on non-Linux platforms and is needed
    # all the time on Linux.
    env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH

    additional_args = []
    if args.platform == 'win32':
        exe = os.path.join('.', 'content_shell.exe')
    elif args.platform == 'darwin':
        exe = os.path.join('.', 'Content Shell.app', 'Contents', 'MacOS',
                           'Content Shell')
        # The Content Shell binary does not directly link against
        # the Content Shell Framework (it is loaded at runtime). Ensure that
        # symbols are dumped for the Framework too.
        additional_args = [
            '--additional-binary',
            os.path.join('.', 'Content Shell.app', 'Contents', 'Frameworks',
                         'Content Shell Framework.framework', 'Versions',
                         'Current', 'Content Shell Framework')
        ]
    elif args.platform == 'android':
        exe = os.path.join('.', 'lib.unstripped',
                           'libcontent_shell_content_view.so')
    else:
        exe = os.path.join('.', 'content_shell')

    with common.temporary_file() as tempfile_path:
        env['CHROME_HEADLESS'] = '1'
        rc = xvfb.run_executable([
            sys.executable,
            os.path.join(common.SRC_DIR, 'content', 'shell', 'tools',
                         'breakpad_integration_test.py'),
            '--verbose',
            '--build-dir',
            '.',
            '--binary',
            exe,
            '--json',
            tempfile_path,
            '--platform',
            args.platform,
        ] + additional_args, env)

        with open(tempfile_path) as f:
            failures = json.load(f)

    if args.isolated_script_test_output:
        with open(args.isolated_script_test_output, 'w') as fp:
            common.record_local_script_results('content_shell_crash_test', fp,
                                               failures, True)

    return rc