Commit 9a7c2471 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

run-swarmed: Add a --no-build flag.

I never want run-swarmed to build stuff, I only want it to run already
built stuff on swarming.

I think that should be the default, but I'll talk to a few people
who use this script before changing the default.

For now, just add a flag so that folks can opt out of building.

Also, as a usability improvement on Windows, if "foo.exe" is passed
in, just strip the ".exe" for internal processing instead of throwing
an unfriendly error about it.

Bug: none
Change-Id: I7762e80347f6fd529ecd4328c7161ede0c5d8d26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2042190Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738962}
parent 30cccc9e
...@@ -151,6 +151,10 @@ def main(): ...@@ -151,6 +151,10 @@ def main():
parser.add_argument('--target-os', default='detect', help='gn target_os') parser.add_argument('--target-os', default='detect', help='gn target_os')
parser.add_argument('--arch', '-a', default='detect', parser.add_argument('--arch', '-a', default='detect',
help='CPU architecture of the test binary.') help='CPU architecture of the test binary.')
parser.add_argument( '--build', dest='build', action='store_true',
help='Build before isolating (default).')
parser.add_argument( '--no-build', dest='build', action='store_false',
help='Do not build, just isolate.')
parser.add_argument('--copies', '-n', type=int, default=1, parser.add_argument('--copies', '-n', type=int, default=1,
help='Number of copies to spawn.') help='Number of copies to spawn.')
parser.add_argument('--device-os', default='M', parser.add_argument('--device-os', default='M',
...@@ -165,6 +169,9 @@ def main(): ...@@ -165,6 +169,9 @@ def main():
parser.add_argument('out_dir', type=str, help='Build directory.') parser.add_argument('out_dir', type=str, help='Build directory.')
parser.add_argument('target_name', type=str, help='Name of target to run.') parser.add_argument('target_name', type=str, help='Name of target to run.')
# TODO(thakis): Should this default to false?
parser.set_defaults(build=True)
args = parser.parse_args() args = parser.parse_args()
if args.target_os == 'detect': if args.target_os == 'detect':
...@@ -190,6 +197,10 @@ def main(): ...@@ -190,6 +197,10 @@ def main():
'fuchsia': 'Linux' 'fuchsia': 'Linux'
}[args.target_os] }[args.target_os]
if args.target_os == 'win' and args.target_name.endswith('.exe'):
# The machinery expects not to have a '.exe' suffix.
args.target_name = os.path.splitext(args.target_name)[0]
# Determine the CPU architecture of the test binary, if not specified. # Determine the CPU architecture of the test binary, if not specified.
if args.arch == 'detect' and args.target_os == 'fuchsia': if args.arch == 'detect' and args.target_os == 'fuchsia':
executable_info = subprocess.check_output( executable_info = subprocess.check_output(
...@@ -199,8 +210,11 @@ def main(): ...@@ -199,8 +210,11 @@ def main():
else: else:
args.arch = 'x86-64' args.arch = 'x86-64'
subprocess.check_call([sys.executable, 'tools/mb/mb.py', mb_cmd = [sys.executable, 'tools/mb/mb.py', 'isolate']
'isolate', '//' + args.out_dir, args.target_name]) if not args.build:
mb_cmd.append('--no-build')
mb_cmd += ['//' + args.out_dir, args.target_name]
subprocess.check_call(mb_cmd)
print('If you get authentication errors, follow:') print('If you get authentication errors, follow:')
print( print(
......
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