Example #1
0
def main():
  signal_util.setup()

  OPTIONS.parse_configure_file()

  parsed_args = launch_chrome_options.parse_args(sys.argv)
  logging_util.setup(
      level=logging.DEBUG if parsed_args.verbose else logging.INFO)

  _prepare_chrome_user_data_dir(parsed_args)
  global _CHROME_PID_PATH
  _CHROME_PID_PATH = os.path.join(_USER_DATA_DIR, 'chrome.pid')

  # If there is an X server at :0.0 and GPU is enabled, set it as the
  # current display.
  if parsed_args.display:
    os.environ['DISPLAY'] = parsed_args.display

  os.chdir(_ROOT_DIR)

  if not parsed_args.remote:
    _kill_running_chrome()

  if parsed_args.run_ninja:
    build_common.run_ninja()

  ld_library_path = os.environ.get('LD_LIBRARY_PATH')
  lib_paths = ld_library_path.split(':') if ld_library_path else []
  lib_paths.append(build_common.get_load_library_path())
  # Add the directory of the chrome binary so that .so files in the directory
  # can be loaded. This is needed for loading libudev.so.0.
  # TODO(crbug.com/375609): Remove the hack once it becomes no longer needed.
  lib_paths.append(os.path.dirname(_get_chrome_path(parsed_args)))
  os.environ['LD_LIBRARY_PATH'] = ':'.join(lib_paths)
  launch_chrome_util.set_environment_for_chrome()

  if not platform_util.is_running_on_remote_host():
    _check_apk_existence(parsed_args)

  if not platform_util.is_running_on_remote_host():
    prep_launch_chrome.prepare_crx(parsed_args)
  prep_launch_chrome.remove_crx_at_exit_if_needed(parsed_args)

  if parsed_args.remote:
    remote_executor.launch_remote_chrome(parsed_args, sys.argv[1:])
  else:
    platform_util.assert_machine(OPTIONS.target())
    _check_crx_existence(parsed_args)
    _run_chrome_iterations(parsed_args)

  return 0
Example #2
0
def _process_args(raw_args):
    args = parse_args(raw_args)
    logging_util.setup(
        level=logging.DEBUG if args.output == 'verbose' else logging.WARNING)

    OPTIONS.parse_configure_file()

    # Limit to one job at a time when running a suite multiple times.  Otherwise
    # suites start interfering with each others operations and bad things happen.
    if args.repeat_runs > 1:
        args.jobs = 1

    if args.buildbot and OPTIONS.weird():
        args.exclude_patterns.append('cts.*')

    # Fixup all patterns to at least be a prefix match for all tests.
    # This allows options like "-t cts.CtsHardwareTestCases" to work to select all
    # the tests in the suite.
    args.include_patterns = [(pattern if '*' in pattern else (pattern + '*'))
                             for pattern in args.include_patterns]
    args.exclude_patterns = [(pattern if '*' in pattern else (pattern + '*'))
                             for pattern in args.exclude_patterns]

    set_test_global_state(args)

    if (not args.remote and args.buildbot
            and not platform_util.is_running_on_cygwin()):
        print_chrome_version()

    if platform_util.is_running_on_remote_host():
        args.run_ninja = False

    return args
Example #3
0
def _process_args(raw_args):
  args = parse_args(raw_args)
  logging_util.setup(
      level=logging.DEBUG if args.output == 'verbose' else logging.WARNING)

  OPTIONS.parse_configure_file()

  # Limit to one job at a time when running a suite multiple times.  Otherwise
  # suites start interfering with each others operations and bad things happen.
  if args.repeat_runs > 1:
    args.jobs = 1

  if args.buildbot and OPTIONS.weird():
    args.exclude_patterns.append('cts.*')

  # Fixup all patterns to at least be a prefix match for all tests.
  # This allows options like "-t cts.CtsHardwareTestCases" to work to select all
  # the tests in the suite.
  args.include_patterns = [(pattern if '*' in pattern else (pattern + '*'))
                           for pattern in args.include_patterns]
  args.exclude_patterns = [(pattern if '*' in pattern else (pattern + '*'))
                           for pattern in args.exclude_patterns]

  set_test_global_state(args)

  if (not args.remote and args.buildbot and
      not platform_util.is_running_on_cygwin()):
    print_chrome_version()

  if platform_util.is_running_on_remote_host():
    args.run_ninja = False

  return args
Example #4
0
 def setUp(self, test_methods_to_run):
     if not self._first_run or platform_util.is_running_on_remote_host():
         # When |self._first_run| is False, the test suite is being retried.
         # In this case we need to update the shell command written in the CRX
         # manifest, which specifies the tests to run, so that only failed tests
         # are retried.
         # When running on a remote host, the shell command needs to be
         # rewritten even at the first run so that platform dependent
         # test configurations are reflected.
         prep_launch_chrome.update_shell_command(
             self._build_launch_chrome_command(test_methods_to_run))
     self._result_parser = result_parser.AtfInstrumentationResultParser()
     self._first_run = False
Example #5
0
 def setUp(self, test_methods_to_run):
   if not self._first_run or platform_util.is_running_on_remote_host():
     # When |self._first_run| is False, the test suite is being retried.
     # In this case we need to update the shell command written in the CRX
     # manifest, which specifies the tests to run, so that only failed tests
     # are retried.
     # When running on a remote host, the shell command needs to be
     # rewritten even at the first run so that platform dependent
     # test configurations are reflected.
     prep_launch_chrome.update_shell_command(
         self._build_launch_chrome_command(test_methods_to_run))
   self._result_parser = result_parser.AtfInstrumentationResultParser()
   self._first_run = False
Example #6
0
def maybe_detect_remote_host_type(parsed_args):
    """Sets remote_host_type if necessary.

  This function ensures that parsed_args has |remote_host_type| value,
  if it has |remote|.
  On remote execution, this function checks if remote_host_type is already
  set or not. If not, detects the remote host type by communicating with the
  remote machine by using |remote| and |ssh_key| values.

  Unfortunately, currently ArgumentParser does not support default values
  evaluated lazily (after actual parsing) with already parsed arguments.
  So, all parsers using add_remote_arguments() defined above need to call
  this function just after its parse_known_args() family.
  """
    if platform_util.is_running_on_remote_host():
        # On remote machine, we expect --remote flag is removed.
        assert parsed_args.remote is None, (
            'Found --remote flag, but the script runs on the remote machine.')

        # Detect the remote_host_type of the machine, and fix up or verify
        # the parsed flag.
        if platform_util.is_running_on_cygwin():
            remote_host_type = 'cygwin'
        elif platform_util.is_running_on_mac():
            remote_host_type = 'mac'
        elif platform_util.is_running_on_chromeos():
            remote_host_type = 'chromeos'
        else:
            raise Exception('Unknown platform')

        if parsed_args.remote_host_type is None:
            parsed_args.remote_host_type = remote_host_type
        assert parsed_args.remote_host_type == remote_host_type, (
            '--remote_host_type is mismatching: "%s" vs "%s"' %
            (parsed_args.remote_host_type, remote_host_type))
        return

    # Hereafter, this runs on the host machine.
    if parsed_args.remote_host_type or not parsed_args.remote:
        # If --remote-host-type is already set, or it is not --remote execution,
        # we do nothing.
        return
    parsed_args.remote_host_type = remote_executor_util.detect_remote_host_type(
        parsed_args.remote, parsed_args.ssh_key)
Example #7
0
def maybe_detect_remote_host_type(parsed_args):
  """Sets remote_host_type if necessary.

  This function ensures that parsed_args has |remote_host_type| value,
  if it has |remote|.
  On remote execution, this function checks if remote_host_type is already
  set or not. If not, detects the remote host type by communicating with the
  remote machine by using |remote| and |ssh_key| values.

  Unfortunately, currently ArgumentParser does not support default values
  evaluated lazily (after actual parsing) with already parsed arguments.
  So, all parsers using add_remote_arguments() defined above need to call
  this function just after its parse_known_args() family.
  """
  if platform_util.is_running_on_remote_host():
    # On remote machine, we expect --remote flag is removed.
    assert parsed_args.remote is None, (
        'Found --remote flag, but the script runs on the remote machine.')

    # Detect the remote_host_type of the machine, and fix up or verify
    # the parsed flag.
    if platform_util.is_running_on_cygwin():
      remote_host_type = 'cygwin'
    elif platform_util.is_running_on_mac():
      remote_host_type = 'mac'
    elif platform_util.is_running_on_chromeos():
      remote_host_type = 'chromeos'
    else:
      raise Exception('Unknown platform')

    if parsed_args.remote_host_type is None:
      parsed_args.remote_host_type = remote_host_type
    assert parsed_args.remote_host_type == remote_host_type, (
        '--remote_host_type is mismatching: "%s" vs "%s"' % (
            parsed_args.remote_host_type, remote_host_type))
    return

  # Hereafter, this runs on the host machine.
  if parsed_args.remote_host_type or not parsed_args.remote:
    # If --remote-host-type is already set, or it is not --remote execution,
    # we do nothing.
    return
  parsed_args.remote_host_type = remote_executor_util.detect_remote_host_type(
      parsed_args.remote, parsed_args.ssh_key)
Example #8
0
def _select_output_handler(parsed_args, stats, chrome_process, **kwargs):
  if parsed_args.mode == 'atftest':
    handler = output_handler.AtfTestHandler()
  elif parsed_args.mode == 'perftest':
    handler = output_handler.PerfTestHandler(
        parsed_args, stats, chrome_process, **kwargs)
  else:
    handler = concurrent_subprocess.RedirectOutputHandler(
        *['.*' + re.escape(suppress) for suppress in _SUPPRESS_LIST])

  if 'gpu' in parsed_args.gdb or 'renderer' in parsed_args.gdb:
    handler = gdb_util.GdbHandlerAdapter(
        handler, parsed_args.gdb, parsed_args.gdb_type)

  if 'plugin' in parsed_args.gdb:
    if OPTIONS.is_nacl_build():
      handler = gdb_util.NaClGdbHandlerAdapter(
          handler, _get_nacl_irt_path(parsed_args), parsed_args.gdb_type)
    elif OPTIONS.is_bare_metal_build():
      handler = gdb_util.BareMetalGdbHandlerAdapter(
          handler, _get_nacl_helper_nonsfi_path(parsed_args),
          parsed_args.gdb_type)

  if (parsed_args.enable_arc_strace and
      parsed_args.arc_strace_output != 'stderr'):
    handler = output_handler.ArcStraceFilter(
        handler, parsed_args.arc_strace_output)

  handler = output_handler.CrashAddressFilter(handler)

  if not platform_util.is_running_on_remote_host():
    # Filters that need to run on local host.
    # See remote_executor_util.run_with_filter
    handler = minidump_filter.MinidumpFilter(handler)

    if parsed_args.jdb_port:
      handler = jdb_util.JdbHandlerAdapter(
          handler, parsed_args.jdb_port, parsed_args.jdb_type)

  if parsed_args.chrome_flakiness_retry:
    handler = output_handler.ChromeFlakinessHandler(handler, chrome_process)

  return output_handler.ChromeStatusCodeHandler(handler)
Example #9
0
def get_chrome_exe_path():
    """Returns the chrome path based on the platform the script is running on."""
    if platform_util.is_running_on_remote_host():
        return _get_chrome_exe_path_on_remote_host()
    return build_common.get_chrome_exe_path_on_local_host()
Example #10
0
def get_chrome_exe_path():
  """Returns the chrome path based on the platform the script is running on."""
  if platform_util.is_running_on_remote_host():
    return _get_chrome_exe_path_on_remote_host()
  return build_common.get_chrome_exe_path_on_local_host()