Commit f82cbb51 authored by Dirk Pranke's avatar Dirk Pranke Committed by Commit Bot

Have ChromeOS bin/run wrappers call test_env.py directly

Currently, when a bot runs a test (say, url_unittests) on a
is_chromeos_device build, it'll launch
`python test_env.py bin/run_url_unittests` (roughly speaking).

This CL flips that around so that the generated bin/run_ wrapper
script launches url_unittests via test_env.py (and the bot will
invoke bin/run_url_unittests directly).

This will make ChromeOS consistent with every platform other
than Android; Android will be converted to match as well in a
separate CL.

Note that apart from the test_env.py inversion, the location
of various other command line argument injections is unchanged,
so bin/run_url_unittests should run with the same args as before.

Bug: 816629
Change-Id: I5d0ac2ed847acb9685b27c41df1ed616311f64a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368537
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822012}
parent 70d0545a
......@@ -12,7 +12,7 @@ import os
import sys
SCRIPT_TEMPLATE = """\
#!/usr/bin/env python
#!/usr/bin/env vpython
#
# This file was generated by build/chromeos/create_test_runner_script.py
......@@ -24,16 +24,16 @@ def main():
def ResolvePath(path):
return os.path.abspath(os.path.join(script_directory, path))
vm_test_script = os.path.abspath(
os.path.join(script_directory, '{vm_test_script}'))
test_env_py = ResolvePath('{test_env_py}')
vm_test_script = ResolvePath('{vm_test_script}')
vm_args = {vm_test_args}
path_args = {vm_test_path_args}
for arg, path in path_args:
vm_args.extend([arg, ResolvePath(path)])
os.execv(vm_test_script,
[vm_test_script] + vm_args + sys.argv[1:])
os.execv(test_env_py,
[test_env_py, vm_test_script] + vm_args + sys.argv[1:])
if __name__ == '__main__':
sys.exit(main())
......@@ -61,6 +61,11 @@ def main(args):
run_test_path = RelativizePathToScript(
os.path.join(os.path.dirname(__file__), 'test_runner.py'))
test_env_path = RelativizePathToScript(
os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
'testing', 'test_env.py'))
vm_test_args = []
if args.test_exe:
vm_test_args.extend([
......@@ -110,6 +115,7 @@ def main(args):
with open(args.script_output_path, 'w') as script:
script.write(
SCRIPT_TEMPLATE.format(
test_env_py=test_env_path,
vm_test_script=run_test_path,
vm_test_args=str(vm_test_args),
vm_test_path_args=str(vm_test_path_args)))
......
......@@ -112,6 +112,7 @@ template("generate_runner_script") {
data = [
"//.vpython",
"//testing/test_env.py",
# We use android test-runner's results libs to construct gtest output
# json.
......
......@@ -1547,7 +1547,6 @@ class MetaBuildWrapper(object):
]
elif is_cros_device and test_type != 'script':
cmdline += [
'../../testing/test_env.py',
os.path.join('bin', 'run_%s' % target),
'--logs-dir=${ISOLATED_OUTDIR}',
]
......
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