def launch_remote_chrome(parsed_args, argv): try: attach_nacl_gdb_type = None nacl_helper_nonsfi_binary = None need_copy_nacl_helper_nonsfi_binary = False jdb_port = None jdb_type = None if 'plugin' in parsed_args.gdb: attach_nacl_gdb_type = parsed_args.gdb_type if OPTIONS.is_bare_metal_build(): nacl_helper_nonsfi_binary = parsed_args.nacl_helper_nonsfi_binary if not nacl_helper_nonsfi_binary: # We decide the path here, but the binary can be copied after # RemoteExecutor is constructed. nacl_helper_nonsfi_binary = os.path.join( remote_executor_util.get_remote_binaries_dir(), os.path.basename(_REMOTE_NACL_HELPER_NONSFI_BINARY)) need_copy_nacl_helper_nonsfi_binary = True if 'jdb_port' in vars(parsed_args) and 'jdb_type' in vars(parsed_args): jdb_port = parsed_args.jdb_port jdb_type = parsed_args.jdb_type executor = _create_remote_executor( parsed_args, attach_nacl_gdb_type=attach_nacl_gdb_type, nacl_helper_nonsfi_binary=nacl_helper_nonsfi_binary, arc_dir_name=parsed_args.remote_arc_dir_name, jdb_port=jdb_port, jdb_type=jdb_type) copied_files = remote_executor_util.get_launch_chrome_deps(parsed_args) _setup_remote_environment(parsed_args, executor, copied_files) if need_copy_nacl_helper_nonsfi_binary: remote_binaries = [_REMOTE_NACL_HELPER_NONSFI_BINARY] executor.copy_remote_files( remote_binaries, remote_executor_util.get_remote_binaries_dir()) if nacl_helper_nonsfi_binary: # This should not happen, but for just in case. assert os.path.exists(nacl_helper_nonsfi_binary) # -v: show the killed process, -w: wait for the killed process to die. executor.run('sudo killall -vw gdbserver', ignore_failure=True) command = ' '.join( ['sudo', '-u', 'chronos', executor.get_remote_env()] + launch_chrome_util.get_launch_chrome_command( remote_executor_util.create_launch_remote_chrome_param(argv))) executor.run_with_filter(command) except subprocess.CalledProcessError as e: sys.exit(e.returncode)
def _atftest(self, args=None): if not args: raise Exception("At least one parameter needed for atftest") if self._args.verbose: args.append('-v') remote_executor.copy_remote_arguments(self._args, args) self._run(launch_chrome_util.get_launch_chrome_command([ 'atftest', '--noninja', '--chrome-flakiness-retry=3', ] + args))
def launch_remote_chrome(parsed_args, argv): try: attach_nacl_gdb_type = None nacl_helper_nonsfi_binary = None need_copy_nacl_helper_nonsfi_binary = False jdb_port = None jdb_type = None if "plugin" in parsed_args.gdb: attach_nacl_gdb_type = parsed_args.gdb_type if OPTIONS.is_bare_metal_build(): nacl_helper_nonsfi_binary = parsed_args.nacl_helper_nonsfi_binary if not nacl_helper_nonsfi_binary: # We decide the path here, but the binary can be copied after # RemoteExecutor is constructed. nacl_helper_nonsfi_binary = os.path.join( remote_executor_util.get_remote_binaries_dir(), os.path.basename(_REMOTE_NACL_HELPER_NONSFI_BINARY), ) need_copy_nacl_helper_nonsfi_binary = True if "jdb_port" in vars(parsed_args) and "jdb_type" in vars(parsed_args): jdb_port = parsed_args.jdb_port jdb_type = parsed_args.jdb_type executor = _create_remote_executor( parsed_args, attach_nacl_gdb_type=attach_nacl_gdb_type, nacl_helper_nonsfi_binary=nacl_helper_nonsfi_binary, arc_dir_name=parsed_args.remote_arc_dir_name, jdb_port=jdb_port, jdb_type=jdb_type, ) copied_files = remote_executor_util.get_launch_chrome_deps(parsed_args) _setup_remote_environment(parsed_args, executor, copied_files) if need_copy_nacl_helper_nonsfi_binary: remote_binaries = [_REMOTE_NACL_HELPER_NONSFI_BINARY] executor.copy_remote_files(remote_binaries, remote_executor_util.get_remote_binaries_dir()) if nacl_helper_nonsfi_binary: # This should not happen, but for just in case. assert os.path.exists(nacl_helper_nonsfi_binary) # -v: show the killed process, -w: wait for the killed process to die. executor.run("sudo killall -vw gdbserver", ignore_failure=True) command = " ".join( ["sudo", "-u", "chronos", executor.get_remote_env()] + launch_chrome_util.get_launch_chrome_command(remote_executor_util.create_launch_remote_chrome_param(argv)) ) executor.run_with_filter(command) except subprocess.CalledProcessError as e: sys.exit(e.returncode)
def _perftest(self, args=None): if args is None: args = [] if self._args.verbose: args.append('-v') remote_executor.copy_remote_arguments(self._args, args) self._run(launch_chrome_util.get_launch_chrome_command([ 'perftest', '--noninja', '--iterations=' + str(self._args.iterations), '--chrome-flakiness-retry=3', ] + args))
def _atftest(self, args=None): if not args: raise Exception("At least one parameter needed for atftest") if self._args.verbose: args.append('-v') remote_executor.copy_remote_arguments(self._args, args) self._run( launch_chrome_util.get_launch_chrome_command([ 'atftest', '--noninja', '--chrome-flakiness-retry=3', ] + args))
def get_launch_chrome_command(self, additional_args, mode=None, name_override=None, additional_metadata=None): """Returns the commandline for running suite runner with launch_chrome.""" args = launch_chrome_util.get_launch_chrome_command() if mode: args.append(mode) name = name_override if name_override else self._name args.extend([ '--crx-name-override=' + name, '--noninja', '--disable-sleep-on-blur' ]) if self._user_data_dir: args.append('--user-data-dir=' + self._user_data_dir) else: args.append('--use-temporary-data-dirs') # Force software GPU emulation mode when running tests under Xvfb. if self._args.enable_osmesa or self._args.use_xvfb: args.append('--enable-osmesa') if self._metadata or additional_metadata: suite_additional_metadata = self._metadata.copy() or {} additional_metadata = additional_metadata or {} assert all(key not in suite_additional_metadata for key in additional_metadata), ( 'Overlap between %s and %s' % (additional_metadata, suite_additional_metadata)) suite_additional_metadata.update(additional_metadata) args.append('--additional-metadata=' + json.dumps(suite_additional_metadata)) args.extend(self._args.launch_chrome_opts) deadline = self.deadline if self._args.min_deadline: deadline = max(deadline, self._args.min_deadline) if self._args.max_deadline: deadline = min(deadline, self._args.max_deadline) args.append('--timeout=' + str(deadline)) # chrome-flakiness-retry option is incompatible with debuggers, do # a quick check before adding the option. # The flags are: --jdb, --jdb-port and --gdb. if not any( re.match('--(gdb(=.+)?|jdb|jdb-port(=.+)?)$', arg) for arg in args): args.append('--chrome-flakiness-retry=%d' % LAUNCH_CHROME_FLAKE_RETRY_COUNT) return args + additional_args
def _perftest(self, args=None): if args is None: args = [] if self._args.verbose: args.append('-v') remote_executor.copy_remote_arguments(self._args, args) self._run( launch_chrome_util.get_launch_chrome_command([ 'perftest', '--noninja', '--iterations=' + str(self._args.iterations), '--chrome-flakiness-retry=3', ] + args))
def get_launch_chrome_command(self, additional_args, mode=None, name_override=None, additional_metadata=None): """Returns the commandline for running suite runner with launch_chrome.""" args = launch_chrome_util.get_launch_chrome_command() if mode: args.append(mode) name = name_override if name_override else self._name args.extend(['--crx-name-override=' + name, '--noninja', '--disable-sleep-on-blur']) if self._user_data_dir: args.append('--user-data-dir=' + self._user_data_dir) else: args.append('--use-temporary-data-dirs') # Force software GPU emulation mode when running tests under Xvfb. if self._args.enable_osmesa or self._args.use_xvfb: args.append('--enable-osmesa') if self._metadata or additional_metadata: suite_additional_metadata = self._metadata.copy() or {} additional_metadata = additional_metadata or {} assert all(key not in suite_additional_metadata for key in additional_metadata), ( 'Overlap between %s and %s' % ( additional_metadata, suite_additional_metadata)) suite_additional_metadata.update(additional_metadata) args.append('--additional-metadata=' + json.dumps(suite_additional_metadata)) args.extend(self._args.launch_chrome_opts) deadline = self.deadline if self._args.min_deadline: deadline = max(deadline, self._args.min_deadline) if self._args.max_deadline: deadline = min(deadline, self._args.max_deadline) args.append('--timeout=' + str(deadline)) # chrome-flakiness-retry option is incompatible with debuggers, do # a quick check before adding the option. # The flags are: --jdb, --jdb-port and --gdb. if not any(re.match('--(gdb(=.+)?|jdb|jdb-port(=.+)?)$', arg) for arg in args): args.append( '--chrome-flakiness-retry=%d' % LAUNCH_CHROME_FLAKE_RETRY_COUNT) return args + additional_args
def launch_remote_chrome(parsed_args, argv): executor = remote_executor_util.create_remote_executor(parsed_args) try: executor.rsync( remote_executor_util.get_launch_chrome_deps(parsed_args), executor.get_remote_arc_root()) command = ' '.join( ['cd', executor.get_remote_arc_root(), '&&', remote_executor_util.SYNC_CHROME, '--verbose', '&&', remote_executor_util.SYNC_ADB, '--target=mac-x86_64', '&&'] + launch_chrome_util.get_launch_chrome_command( remote_executor_util.create_launch_remote_chrome_param(argv))) executor.run_with_filter(command) return 0 except subprocess.CalledProcessError as e: return e.returncode
def launch_remote_chrome(parsed_args, argv): executor = _create_remote_executor(parsed_args) try: executor.rsync( remote_executor_util.get_launch_chrome_deps(parsed_args), executor.get_remote_arc_root()) _set_nacl_resource_permission(executor) # To launch arc successfully, it is necessary to set TMP env value # manually here (the param is usually delegated from the parent process). command = ' '.join( ['cd', executor.get_remote_arc_root(), '&&', remote_executor_util.SYNC_CHROME, '--verbose', '&&', remote_executor_util.SYNC_ADB, '--target=win-x86_64', '&&', executor.get_remote_env()] + launch_chrome_util.get_launch_chrome_command( remote_executor_util.create_launch_remote_chrome_param(argv))) executor.run_with_filter(command) return 0 except subprocess.CalledProcessError as e: return e.returncode
def launch_remote_chrome(parsed_args, argv): executor = _create_remote_executor(parsed_args) try: executor.rsync( remote_executor_util.get_launch_chrome_deps(parsed_args), executor.get_remote_arc_root()) _set_nacl_resource_permission(executor) # To launch arc successfully, it is necessary to set TMP env value # manually here (the param is usually delegated from the parent process). command = ' '.join([ 'cd', executor.get_remote_arc_root(), '&&', remote_executor_util.SYNC_CHROME, '--verbose', '&&', remote_executor_util.SYNC_ADB, '--target=win-x86_64', '&&', executor.get_remote_env() ] + launch_chrome_util.get_launch_chrome_command( remote_executor_util.create_launch_remote_chrome_param(argv))) executor.run_with_filter(command) return 0 except subprocess.CalledProcessError as e: return e.returncode
def _run_arc_perf(self): return self._accumulate_subprocess_output( launch_chrome_util.get_launch_chrome_command( ['run', 'mods/examples/PepperPerf/android/bin/GLPerf-debug.apk']), '--------------- END ---------------')
def _run_arc_perf(self): return self._accumulate_subprocess_output( launch_chrome_util.get_launch_chrome_command([ 'run', 'mods/examples/PepperPerf/android/bin/GLPerf-debug.apk' ]), '--------------- END ---------------')