def host_cmd(args, unknown_args): if not args.cmd: logging.error('Must specify command to run on the host.') return 1 elif unknown_args: logging.error( 'Args "%s" unsupported. Is your host command correctly formatted?', ' '.join(unknown_args)) return 1 cros_run_vm_test_cmd = [ CROS_RUN_VM_TEST_PATH, '--start', '--board', args.board, '--cache-dir', args.cros_cache, ] if args.verbose: cros_run_vm_test_cmd.append('--debug') cros_run_vm_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_vm_test_cmd)) return subprocess42.call( cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr)
def host_cmd(args, unknown_args): if not args.cmd: logging.error('Must specify command to run on the host.') return 1 elif unknown_args: logging.error( 'Args "%s" unsupported. Is your host command correctly formatted?', ' '.join(unknown_args)) return 1 cros_run_vm_test_cmd = [ CROS_RUN_VM_TEST_PATH, '--start', '--board', args.board, '--cache-dir', args.cros_cache, ] if args.verbose: cros_run_vm_test_cmd.append('--debug') cros_run_vm_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_vm_test_cmd)) return subprocess42.call(cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr)
def host_cmd(args, unknown_args): if not args.cmd: raise TestFormatError('Must specify command to run on the host.') elif unknown_args: raise TestFormatError( 'Args "%s" unsupported. Is your host command correctly formatted?' % (' '.join(unknown_args))) elif args.deploy_chrome and not args.path_to_outdir: raise TestFormatError( '--path-to-outdir must be specified if --deploy-chrome is passed.') cros_run_test_cmd = [ CROS_RUN_TEST_PATH, '--board', args.board, '--cache-dir', args.cros_cache, ] if args.use_vm: cros_run_test_cmd += [ '--start', # Don't persist any filesystem changes after the VM shutsdown. '--copy-on-write', '--device', 'localhost', ] else: cros_run_test_cmd += [ '--device', args.device if args.device else LAB_DUT_HOSTNAME ] if args.verbose: cros_run_test_cmd.append('--debug') if args.logs_dir: for log in SYSTEM_LOG_LOCATIONS: cros_run_test_cmd += ['--results-src', log] cros_run_test_cmd += ['--results-dest-dir', args.logs_dir] test_env = setup_env() if args.deploy_chrome: cros_run_test_cmd += [ '--deploy', # Mounting the browser gives it enough disk space to not need stripping. '--mount', '--nostrip', '--build-dir', os.path.abspath(args.path_to_outdir), ] cros_run_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_test_cmd)) return subprocess42.call( cros_run_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def host_cmd(args, unknown_args): if not args.cmd: raise TestFormatError('Must specify command to run on the host.') elif unknown_args: raise TestFormatError( 'Args "%s" unsupported. Is your host command correctly formatted?' % (' '.join(unknown_args))) elif args.deploy_chrome and not args.path_to_outdir: raise TestFormatError( '--path-to-outdir must be specified if --deploy-chrome is passed.') cros_run_vm_test_cmd = [ CROS_RUN_VM_TEST_PATH, '--start', '--board', args.board, '--cache-dir', args.cros_cache, # Don't persist any filesystem changes after the VM shutsdown. '--copy-on-write', ] if args.verbose: cros_run_vm_test_cmd.append('--debug') test_env = os.environ.copy() if args.deploy_chrome: cros_run_vm_test_cmd += [ '--deploy', '--build-dir', os.path.abspath(args.path_to_outdir), ] # If we're deploying, push chromite/bin's deploy_chrome onto PATH. test_env['PATH'] = (test_env['PATH'] + ':' + os.path.join(CHROMITE_PATH, 'bin')) # deploy_chrome needs a set of GN args used to build chrome to determine if # certain libraries need to be pushed to the VM. It looks for the args via # an env var. To trigger the default deploying behavior, give it a dummy set # of args. # TODO(crbug.com/823996): Make the GN-dependent deps controllable via cmd # line args. if not test_env.get('GN_ARGS'): test_env['GN_ARGS'] = 'is_chromeos = true' cros_run_vm_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_vm_test_cmd)) return subprocess42.call(cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def host_cmd(args, unknown_args): if not args.cmd: raise TestFormatError('Must specify command to run on the host.') elif unknown_args: raise TestFormatError( 'Args "%s" unsupported. Is your host command correctly formatted?' % ( ' '.join(unknown_args))) elif args.deploy_chrome and not args.path_to_outdir: raise TestFormatError( '--path-to-outdir must be specified if --deploy-chrome is passed.') cros_run_vm_test_cmd = [ CROS_RUN_VM_TEST_PATH, '--start', '--board', args.board, '--cache-dir', args.cros_cache, ] if args.verbose: cros_run_vm_test_cmd.append('--debug') test_env = os.environ.copy() if args.deploy_chrome: cros_run_vm_test_cmd += [ '--deploy', '--build-dir', os.path.abspath(args.path_to_outdir), ] # If we're deploying, push chromite/bin's deploy_chrome onto PATH. test_env['PATH'] = ( test_env['PATH'] + ':' + os.path.join(CHROMITE_PATH, 'bin')) # deploy_chrome needs a set of GN args used to build chrome to determine if # certain libraries need to be pushed to the VM. It looks for the args via # an env var. To trigger the default deploying behavior, give it a dummy set # of args. # TODO(crbug.com/823996): Make the GN-dependent deps controllable via cmd # line args. if not test_env.get('GN_ARGS'): test_env['GN_ARGS'] = 'is_chromeos = true' cros_run_vm_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_vm_test_cmd)) return subprocess42.call( cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def host_cmd(args, unknown_args): if not args.cmd: raise TestFormatError('Must specify command to run on the host.') elif unknown_args: raise TestFormatError( 'Args "%s" unsupported. Is your host command correctly formatted?' % ( ' '.join(unknown_args))) elif args.deploy_chrome and not args.path_to_outdir: raise TestFormatError( '--path-to-outdir must be specified if --deploy-chrome is passed.') cros_run_test_cmd = [ CROS_RUN_TEST_PATH, '--board', args.board, '--cache-dir', args.cros_cache, ] if args.use_vm: cros_run_test_cmd += [ '--start', # Don't persist any filesystem changes after the VM shutsdown. '--copy-on-write', '--device', 'localhost', ] else: cros_run_test_cmd += [ '--device', args.device if args.device else LAB_DUT_HOSTNAME ] if args.verbose: cros_run_test_cmd.append('--debug') test_env = setup_env() if args.deploy_chrome: cros_run_test_cmd += [ '--deploy', '--mount', '--build-dir', os.path.abspath(args.path_to_outdir), ] cros_run_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_test_cmd)) return subprocess42.call( cros_run_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def host_cmd(args, unknown_args): if not args.cmd: raise TestFormatError('Must specify command to run on the host.') elif unknown_args: raise TestFormatError( 'Args "%s" unsupported. Is your host command correctly formatted?' % (' '.join(unknown_args))) elif args.deploy_chrome and not args.path_to_outdir: raise TestFormatError( '--path-to-outdir must be specified if --deploy-chrome is passed.') cros_run_vm_test_cmd = [ CROS_RUN_VM_TEST_PATH, '--start', '--board', args.board, '--cache-dir', args.cros_cache, # Don't persist any filesystem changes after the VM shutsdown. '--copy-on-write', ] if args.verbose: cros_run_vm_test_cmd.append('--debug') test_env = setup_env() if args.deploy_chrome: cros_run_vm_test_cmd += [ '--deploy', '--build-dir', os.path.abspath(args.path_to_outdir), ] cros_run_vm_test_cmd += [ '--host-cmd', '--', ] + args.cmd logging.info('Running the following command:') logging.info(' '.join(cros_run_vm_test_cmd)) return subprocess42.call(cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def run_recipe(self, universe_view, recipe, properties): with tempfile.NamedTemporaryFile() as f: cmd = [sys.executable, universe_view.universe.package_deps.engine_recipes_py, '--package=%s' % universe_view.universe.config_file.path, 'run', '--output-result-json=%s' % f.name, recipe] cmd.extend(['%s=%s' % (k,repr(v)) for k, v in properties.iteritems()]) retcode = subprocess42.call(cmd) result = json.load(f) if retcode != 0: raise recipe_api.StepFailure( 'depend on %s with properties %r failed with %d.\n' 'Recipe result: %r' % ( recipe, properties, retcode, result)) if self._engine_flags and self._engine_flags.use_result_proto: return json.loads(result['jsonResult']) return result