Commit 5d46ab5b authored by Ben Pastene's avatar Ben Pastene Committed by Commit Bot

Centralize env var tweaking for cros VM tests.

And hard-code enable_nacl, which needs to be set to deploy nacl libs
to the VM.

Change-Id: Iffa9d62c02e33e1822a20f85a5ee2a4c11a7907d
Reviewed-on: https://chromium-review.googlesource.com/c/1258056Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595989}
parent 13cd648c
...@@ -70,19 +70,7 @@ class RemoteTest(object): ...@@ -70,19 +70,7 @@ class RemoteTest(object):
'--results-dest-dir', args.vm_logs_dir, '--results-dest-dir', args.vm_logs_dir,
] ]
self._test_env = os.environ.copy() self._test_env = setup_env()
# 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 self._test_env.get('GN_ARGS'):
self._test_env['GN_ARGS'] = 'is_chromeos = true'
if not self._test_env.get('USE'):
self._test_env['USE'] = 'highdpi'
self._test_env['PATH'] = (
self._test_env['PATH'] + ':' + os.path.join(CHROMITE_PATH, 'bin'))
@property @property
def suite_name(self): def suite_name(self):
...@@ -402,23 +390,12 @@ def host_cmd(args, unknown_args): ...@@ -402,23 +390,12 @@ def host_cmd(args, unknown_args):
if args.verbose: if args.verbose:
cros_run_vm_test_cmd.append('--debug') cros_run_vm_test_cmd.append('--debug')
test_env = os.environ.copy() test_env = setup_env()
if args.deploy_chrome: if args.deploy_chrome:
cros_run_vm_test_cmd += [ cros_run_vm_test_cmd += [
'--deploy', '--deploy',
'--build-dir', os.path.abspath(args.path_to_outdir), '--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 += [ cros_run_vm_test_cmd += [
'--host-cmd', '--host-cmd',
...@@ -432,6 +409,24 @@ def host_cmd(args, unknown_args): ...@@ -432,6 +409,24 @@ def host_cmd(args, unknown_args):
cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env) cros_run_vm_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)
def setup_env():
"""Returns a copy of the current env with some needed vars added."""
env = os.environ.copy()
# Some chromite scripts expect chromite/bin to be on PATH.
env['PATH'] = 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 env.get('GN_ARGS'):
env['GN_ARGS'] = 'enable_nacl = true'
if not env.get('USE'):
env['USE'] = 'highdpi'
return env
def add_common_args(parser): def add_common_args(parser):
parser.add_argument( parser.add_argument(
'--cros-cache', type=str, default=DEFAULT_CROS_CACHE, '--cros-cache', type=str, default=DEFAULT_CROS_CACHE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment