Commit ad6ecbc4 authored by Ye Kuang's avatar Ye Kuang Committed by Commit Bot

Use luci-go isolate client in mb.py

This is identical to these CLs we did to Chromium's mb.py

* https://crrev.com/c/2105272
* https://crrev.com/c/2094482

Bug: chromium:1059167
Change-Id: Ibad4ed0d0655b8bf56a0e7fd672983eac5ac5d38
Reviewers: dpranke@chromium.org, tikuta@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100697Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66828}
parent 404ce209
......@@ -64,6 +64,8 @@ class MetaBuildWrapper(object):
self.luci_tryservers = {}
self.masters = {}
self.mixins = {}
self.isolate_exe = 'isolate.exe' if self.platform.startswith(
'win') else 'isolate'
def Main(self, args):
self.ParseArgs(args)
......@@ -360,19 +362,39 @@ class MetaBuildWrapper(object):
for k, v in self._DefaultDimensions() + self.args.dimensions:
dimensions += ['-d', k, v]
archive_json_path = self.ToSrcRelPath(
'%s/%s.archive.json' % (build_dir, target))
cmd = [
self.executable,
self.PathJoin('tools', 'swarming_client', 'isolate.py'),
self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.isolate_exe),
'archive',
'-i',
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
'-s',
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
'-I', 'isolateserver.appspot.com',
'-dump-json',
archive_json_path,
]
ret, out, _ = self.Run(cmd, force_verbose=False)
ret, _, _ = self.Run(cmd, force_verbose=False)
if ret:
return ret
isolated_hash = out.splitlines()[0].split()[0]
try:
archive_hashes = json.loads(self.ReadFile(archive_json_path))
except Exception:
self.Print(
'Failed to read JSON file "%s"' % archive_json_path, file=sys.stderr)
return 1
try:
isolated_hash = archive_hashes[target]
except Exception:
self.Print(
'Cannot find hash for "%s" in "%s", file content: %s' %
(target, archive_json_path, archive_hashes),
file=sys.stderr)
return 1
cmd = [
self.executable,
self.PathJoin('tools', 'swarming_client', 'swarming.py'),
......@@ -388,11 +410,11 @@ class MetaBuildWrapper(object):
def _RunLocallyIsolated(self, build_dir, target):
cmd = [
self.executable,
self.PathJoin('tools', 'swarming_client', 'isolate.py'),
self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.isolate_exe),
'run',
'-s',
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
'-i',
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
]
if self.args.extra_args:
cmd += ['--'] + self.args.extra_args
......@@ -789,13 +811,11 @@ class MetaBuildWrapper(object):
self.WriteIsolateFiles(build_dir, target, runtime_deps)
ret, _, _ = self.Run([
self.executable,
self.PathJoin('tools', 'swarming_client', 'isolate.py'),
self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.isolate_exe),
'check',
'-i',
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
'-s',
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target))],
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target))],
buffer_output=False)
return ret
......
......@@ -533,16 +533,11 @@ class UnitTest(unittest.TestCase):
'/fake_src/out/Default/base_unittests.runtime_deps': (
"base_unittests\n"
),
'out/Default/base_unittests.archive.json':
("{\"base_unittests\":\"fake_hash\"}"),
}
def run_stub(cmd, **_kwargs):
if 'isolate.py' in cmd[1]:
return 0, 'fake_hash base_unittests', ''
else:
return 0, '', ''
mbw = self.fake_mbw(files=files)
mbw.Run = run_stub
self.check(['run', '-s', '-c', 'debug_goma', '//out/Default',
'base_unittests'], mbw=mbw, ret=0)
self.check(['run', '-s', '-c', 'debug_goma', '-d', 'os', 'Win7',
......
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