Fix mb.py when using isolate archive
This fix is the same as https://crrev.com/c/2105272 Bug: chromium:1062881 Change-Id: Idb24551f4c26100b6983611ca486c0972dca70a6 Reviewers: mbonadei@webrtc.org, tikuta@chromium.org, dpranke@chromium.org Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170960 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Ye Kuang <yekuang@google.com> Cr-Commit-Position: refs/heads/master@{#30826}
This commit is contained in:
@ -338,18 +338,37 @@ class MetaBuildWrapper(object):
|
|||||||
for k, v in self.args.dimensions:
|
for k, v in self.args.dimensions:
|
||||||
dimensions += ['-d', k, v]
|
dimensions += ['-d', k, v]
|
||||||
|
|
||||||
|
archive_json_path = self.ToSrcRelPath(
|
||||||
|
'%s/%s.archive.json' % (build_dir, target))
|
||||||
cmd = [
|
cmd = [
|
||||||
self.PathJoin(self.src_dir, 'tools', 'luci-go', self.isolate_exe),
|
self.PathJoin(self.src_dir, 'tools', 'luci-go', self.isolate_exe),
|
||||||
'archive',
|
'archive',
|
||||||
|
'-i',
|
||||||
|
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
|
||||||
'-s',
|
'-s',
|
||||||
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
|
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
|
||||||
'-I', 'isolateserver.appspot.com',
|
'-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:
|
if ret:
|
||||||
return 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 = [
|
cmd = [
|
||||||
self.executable,
|
self.executable,
|
||||||
self.PathJoin('tools', 'swarming_client', 'swarming.py'),
|
self.PathJoin('tools', 'swarming_client', 'swarming.py'),
|
||||||
|
@ -760,16 +760,11 @@ class UnitTest(unittest.TestCase):
|
|||||||
'/fake_src/out/Default/base_unittests.runtime_deps': (
|
'/fake_src/out/Default/base_unittests.runtime_deps': (
|
||||||
"base_unittests\n"
|
"base_unittests\n"
|
||||||
),
|
),
|
||||||
|
'out/Default/base_unittests.archive.json': (
|
||||||
|
"{\"base_unittests\":\"fake_hash\"}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def run_stub(cmd, **_kwargs):
|
|
||||||
if os.path.join('tools', 'luci-go', 'isolate') in cmd[0]:
|
|
||||||
return 0, 'fake_hash base_unittests', ''
|
|
||||||
else:
|
|
||||||
return 0, '', ''
|
|
||||||
|
|
||||||
mbw = self.fake_mbw(files=files)
|
mbw = self.fake_mbw(files=files)
|
||||||
mbw.Run = run_stub
|
|
||||||
self.check(['run', '-s', '-c', 'debug_goma', '//out/Default',
|
self.check(['run', '-s', '-c', 'debug_goma', '//out/Default',
|
||||||
'base_unittests'], mbw=mbw, ret=0)
|
'base_unittests'], mbw=mbw, ret=0)
|
||||||
self.check(['run', '-s', '-c', 'debug_goma', '-d', 'os', 'Win7',
|
self.check(['run', '-s', '-c', 'debug_goma', '-d', 'os', 'Win7',
|
||||||
|
Reference in New Issue
Block a user