Commit 1cd6fd9f authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[build] Drop Chromium-specific features from V8's MB fork

V8 passes the command explicitly to each swarming task, hence it's
not necessary to store the command in the isolate.

This drops the Chromium-specific code in MB that creates the
swarming command based on Chromium test features.

This also makes the swarming targets option a no-op to allow
activating it on the infra side without disruption.

Bug: chromium:669910
Change-Id: I6cb03f05d034092a25d879d52b4d64952493f55b
Reviewed-on: https://chromium-review.googlesource.com/779148Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49520}
parent 4cc5520a
...@@ -253,6 +253,10 @@ class MetaBuildWrapper(object): ...@@ -253,6 +253,10 @@ class MetaBuildWrapper(object):
self.args = parser.parse_args(argv) self.args = parser.parse_args(argv)
# TODO(machenbach): This prepares passing swarming targets to isolate on the
# infra side.
self.args.swarming_targets_file = None
def DumpInputFiles(self): def DumpInputFiles(self):
def DumpContentsOfFilePassedTo(arg_name, path): def DumpContentsOfFilePassedTo(arg_name, path):
...@@ -326,7 +330,7 @@ class MetaBuildWrapper(object): ...@@ -326,7 +330,7 @@ class MetaBuildWrapper(object):
return 1 return 1
if vals['type'] == 'gn': if vals['type'] == 'gn':
return self.RunGNIsolate(vals) return self.RunGNIsolate()
else: else:
return self.Build('%s_run' % self.args.target[0]) return self.Build('%s_run' % self.args.target[0])
...@@ -356,7 +360,7 @@ class MetaBuildWrapper(object): ...@@ -356,7 +360,7 @@ class MetaBuildWrapper(object):
ret = self.Build(target) ret = self.Build(target)
if ret: if ret:
return ret return ret
ret = self.RunGNIsolate(vals) ret = self.RunGNIsolate()
if ret: if ret:
return ret return ret
else: else:
...@@ -892,16 +896,13 @@ class MetaBuildWrapper(object): ...@@ -892,16 +896,13 @@ class MetaBuildWrapper(object):
raise MBErr('did not generate any of %s' % raise MBErr('did not generate any of %s' %
', '.join(runtime_deps_targets)) ', '.join(runtime_deps_targets))
command, extra_files = self.GetIsolateCommand(target, vals)
runtime_deps = self.ReadFile(runtime_deps_path).splitlines() runtime_deps = self.ReadFile(runtime_deps_path).splitlines()
self.WriteIsolateFiles(build_dir, command, target, runtime_deps, self.WriteIsolateFiles(build_dir, target, runtime_deps)
extra_files)
return 0 return 0
def RunGNIsolate(self, vals): def RunGNIsolate(self):
target = self.args.target[0] target = self.args.target[0]
isolate_map = self.ReadIsolateMap() isolate_map = self.ReadIsolateMap()
err, labels = self.MapTargetsToLabels(isolate_map, [target]) err, labels = self.MapTargetsToLabels(isolate_map, [target])
...@@ -910,7 +911,6 @@ class MetaBuildWrapper(object): ...@@ -910,7 +911,6 @@ class MetaBuildWrapper(object):
label = labels[0] label = labels[0]
build_dir = self.args.path[0] build_dir = self.args.path[0]
command, extra_files = self.GetIsolateCommand(target, vals)
cmd = self.GNCmd('desc', build_dir, label, 'runtime_deps') cmd = self.GNCmd('desc', build_dir, label, 'runtime_deps')
ret, out, _ = self.Call(cmd) ret, out, _ = self.Call(cmd)
...@@ -921,8 +921,7 @@ class MetaBuildWrapper(object): ...@@ -921,8 +921,7 @@ class MetaBuildWrapper(object):
runtime_deps = out.splitlines() runtime_deps = out.splitlines()
self.WriteIsolateFiles(build_dir, command, target, runtime_deps, self.WriteIsolateFiles(build_dir, target, runtime_deps)
extra_files)
ret, _, _ = self.Run([ ret, _, _ = self.Run([
self.executable, self.executable,
...@@ -936,14 +935,12 @@ class MetaBuildWrapper(object): ...@@ -936,14 +935,12 @@ class MetaBuildWrapper(object):
return ret return ret
def WriteIsolateFiles(self, build_dir, command, target, runtime_deps, def WriteIsolateFiles(self, build_dir, target, runtime_deps):
extra_files):
isolate_path = self.ToAbsPath(build_dir, target + '.isolate') isolate_path = self.ToAbsPath(build_dir, target + '.isolate')
self.WriteFile(isolate_path, self.WriteFile(isolate_path,
pprint.pformat({ pprint.pformat({
'variables': { 'variables': {
'command': command, 'files': sorted(runtime_deps),
'files': sorted(runtime_deps + extra_files),
} }
}) + '\n') }) + '\n')
...@@ -1058,97 +1055,6 @@ class MetaBuildWrapper(object): ...@@ -1058,97 +1055,6 @@ class MetaBuildWrapper(object):
return ret return ret
def GetIsolateCommand(self, target, vals):
isolate_map = self.ReadIsolateMap()
is_android = 'target_os="android"' in vals['gn_args']
is_fuchsia = 'target_os="fuchsia"' in vals['gn_args']
# This should be true if tests with type='windowed_test_launcher' are
# expected to run using xvfb. For example, Linux Desktop, X11 CrOS and
# Ozone CrOS builds. Note that one Ozone build can be used to run differen
# backends. Currently, tests are executed for the headless and X11 backends
# and both can run under Xvfb.
# TODO(tonikitoo,msisov,fwang): Find a way to run tests for the Wayland
# backend.
use_xvfb = self.platform == 'linux2' and not is_android and not is_fuchsia
asan = 'is_asan=true' in vals['gn_args']
msan = 'is_msan=true' in vals['gn_args']
tsan = 'is_tsan=true' in vals['gn_args']
cfi_diag = 'use_cfi_diag=true' in vals['gn_args']
test_type = isolate_map[target]['type']
executable = isolate_map[target].get('executable', target)
executable_suffix = '.exe' if self.platform == 'win32' else ''
cmdline = []
extra_files = []
if test_type == 'nontest':
self.WriteFailureAndRaise('We should not be isolating %s.' % target,
output_path=None)
if is_android and test_type != "script":
cmdline = [
'../../build/android/test_wrapper/logdog_wrapper.py',
'--target', target,
'--logdog-bin-cmd', '../../bin/logdog_butler',
'--store-tombstones']
elif is_fuchsia and test_type != 'script':
cmdline = [os.path.join('bin', 'run_%s' % target)]
elif use_xvfb and test_type == 'windowed_test_launcher':
extra_files = [
'../../testing/test_env.py',
'../../testing/xvfb.py',
]
cmdline = [
'../../testing/xvfb.py',
'./' + str(executable) + executable_suffix,
'--brave-new-test-launcher',
'--test-launcher-bot-mode',
'--asan=%d' % asan,
'--msan=%d' % msan,
'--tsan=%d' % tsan,
'--cfi-diag=%d' % cfi_diag,
]
elif test_type in ('windowed_test_launcher', 'console_test_launcher'):
extra_files = [
'../../testing/test_env.py'
]
cmdline = [
'../../testing/test_env.py',
'./' + str(executable) + executable_suffix,
'--brave-new-test-launcher',
'--test-launcher-bot-mode',
'--asan=%d' % asan,
'--msan=%d' % msan,
'--tsan=%d' % tsan,
'--cfi-diag=%d' % cfi_diag,
]
elif test_type == 'script':
extra_files = [
'../../testing/test_env.py'
]
cmdline = [
'../../testing/test_env.py',
'../../' + self.ToSrcRelPath(isolate_map[target]['script'])
]
elif test_type in ('raw'):
extra_files = []
cmdline = [
'./' + str(target) + executable_suffix,
]
else:
self.WriteFailureAndRaise('No command line for %s found (test type %s).'
% (target, test_type), output_path=None)
cmdline += isolate_map[target].get('args', [])
return cmdline, extra_files
def ToAbsPath(self, build_path, *comps): def ToAbsPath(self, build_path, *comps):
return self.PathJoin(self.chromium_src_dir, return self.PathJoin(self.chromium_src_dir,
self.ToSrcRelPath(build_path), self.ToSrcRelPath(build_path),
......
...@@ -430,6 +430,8 @@ class UnitTest(unittest.TestCase): ...@@ -430,6 +430,8 @@ class UnitTest(unittest.TestCase):
mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '') mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '')
self.check(['gen', '-c', 'gn_debug_goma', '//out/Default'], mbw=mbw, ret=1) self.check(['gen', '-c', 'gn_debug_goma', '//out/Default'], mbw=mbw, ret=1)
# TODO(machenbach): Comment back in after swarming file parameter is used.
"""
def test_gn_gen_swarming(self): def test_gn_gen_swarming(self):
files = { files = {
'/tmp/swarming_targets': 'base_unittests\n', '/tmp/swarming_targets': 'base_unittests\n',
...@@ -480,7 +482,7 @@ class UnitTest(unittest.TestCase): ...@@ -480,7 +482,7 @@ class UnitTest(unittest.TestCase):
mbw.files) mbw.files)
self.assertIn('c:\\fake_src\\out\\Default\\cc_perftests.isolated.gen.json', self.assertIn('c:\\fake_src\\out\\Default\\cc_perftests.isolated.gen.json',
mbw.files) mbw.files)
""" # pylint: disable=pointless-string-statement
def test_gn_isolate(self): def test_gn_isolate(self):
files = { files = {
......
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