diff --git a/infra/mb/mb_config.pyl b/infra/mb/mb_config.pyl index b95f7d2fbf..9b2b60b11e 100644 --- a/infra/mb/mb_config.pyl +++ b/infra/mb/mb_config.pyl @@ -7,7 +7,7 @@ # config names (where each config name is a key in the 'configs' dict, # below). MB uses this dict to look up which config to use for a given bot. # Bots are ordered by appearance on waterfall. - 'masters': { + 'builder_groups': { 'developer_default': { 'android.arm.debug': 'default_debug_android_arm', 'android.arm.optdebug': 'default_optdebug_android_arm', diff --git a/tools/mb/mb.py b/tools/mb/mb.py index f3e46158b9..024311f8c1 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py @@ -62,7 +62,7 @@ class MetaBuildWrapper(object): self.args = argparse.Namespace() self.configs = {} self.luci_tryservers = {} - self.masters = {} + self.builder_groups = {} self.mixins = {} self.isolate_exe = 'isolate.exe' if self.platform.startswith( 'win') else 'isolate' @@ -88,8 +88,9 @@ class MetaBuildWrapper(object): def AddCommonOptions(subp): subp.add_argument('-b', '--builder', help='builder name to look up config from') - subp.add_argument('-m', '--master', - help='master name to look up config from') + subp.add_argument( + '-m', '--builder-group', + help='builder group name to look up config from') subp.add_argument('-c', '--config', help='configuration to analyze') subp.add_argument('--phase', @@ -276,10 +277,10 @@ class MetaBuildWrapper(object): def CmdExport(self): self.ReadConfigFile() obj = {} - for master, builders in self.masters.items(): - obj[master] = {} + for builder_group, builders in self.builder_groups.items(): + obj[builder_group] = {} for builder in builders: - config = self.masters[master][builder] + config = self.builder_groups[builder_group][builder] if not config: continue @@ -293,7 +294,7 @@ class MetaBuildWrapper(object): if 'error' in args: continue - obj[master][builder] = args + obj[builder_group][builder] = args # Dump object and trim trailing whitespace. s = '\n'.join(l.rstrip() for l in @@ -450,10 +451,10 @@ class MetaBuildWrapper(object): for bot in sorted(self.luci_tryservers[luci_tryserver]): self.Print('\tbuilder = %s' % bot) - for master in sorted(self.masters): - if master.startswith('tryserver.'): - self.Print('[bucket "master.%s"]' % master) - for bot in sorted(self.masters[master]): + for builder_group in sorted(self.builder_groups): + if builder_group.startswith('tryserver.'): + self.Print('[bucket "builder_group.%s"]' % builder_group) + for bot in sorted(self.builder_groups[builder_group]): self.Print('\tbuilder = %s' % bot) return 0 @@ -466,13 +467,13 @@ class MetaBuildWrapper(object): # Build a list of all of the configs referenced by builders. all_configs = {} - for master in self.masters: - for config in self.masters[master].values(): + for builder_group in self.builder_groups: + for config in self.builder_groups[builder_group].values(): if isinstance(config, dict): for c in config.values(): - all_configs[c] = master + all_configs[c] = builder_group else: - all_configs[config] = master + all_configs[config] = builder_group # Check that every referenced args file or config actually exists. for config, loc in all_configs.items(): @@ -523,7 +524,7 @@ class MetaBuildWrapper(object): build_dir = self.args.path[0] vals = self.DefaultVals() - if self.args.builder or self.args.master or self.args.config: + if self.args.builder or self.args.builder_group or self.args.config: vals = self.Lookup() # Re-run gn gen in order to ensure the config is consistent with the # build dir. @@ -573,10 +574,10 @@ class MetaBuildWrapper(object): return vals def ReadIOSBotConfig(self): - if not self.args.master or not self.args.builder: + if not self.args.builder_group or not self.args.builder: return {} path = self.PathJoin(self.chromium_src_dir, 'ios', 'build', 'bots', - self.args.master, self.args.builder + '.json') + self.args.builder_group, self.args.builder + '.json') if not self.Exists(path): return {} @@ -599,7 +600,7 @@ class MetaBuildWrapper(object): self.configs = contents['configs'] self.luci_tryservers = contents.get('luci_tryservers', {}) - self.masters = contents['masters'] + self.builder_groups = contents['builder_groups'] self.mixins = contents['mixins'] def ReadIsolateMap(self): @@ -626,38 +627,40 @@ class MetaBuildWrapper(object): def ConfigFromArgs(self): if self.args.config: - if self.args.master or self.args.builder: - raise MBErr('Can not specific both -c/--config and -m/--master or ' - '-b/--builder') + if self.args.builder_group or self.args.builder: + raise MBErr( + 'Can not specific both -c/--config and -m/--builder-group or ' + '-b/--builder') return self.args.config - if not self.args.master or not self.args.builder: + if not self.args.builder_group or not self.args.builder: raise MBErr('Must specify either -c/--config or ' - '(-m/--master and -b/--builder)') + '(-m/--builder-group and -b/--builder)') - if not self.args.master in self.masters: - raise MBErr('Master name "%s" not found in "%s"' % - (self.args.master, self.args.config_file)) + if not self.args.builder_group in self.builder_groups: + raise MBErr('Builder groups name "%s" not found in "%s"' % + (self.args.builder_group, self.args.config_file)) - if not self.args.builder in self.masters[self.args.master]: - raise MBErr('Builder name "%s" not found under masters[%s] in "%s"' % - (self.args.builder, self.args.master, self.args.config_file)) + if not self.args.builder in self.builder_groups[self.args.builder_group]: + raise MBErr( + 'Builder name "%s" not found under builder_groups[%s] in "%s"' % + (self.args.builder, self.args.builder_group, self.args.config_file)) - config = self.masters[self.args.master][self.args.builder] + config = self.builder_groups[self.args.builder_group][self.args.builder] if isinstance(config, dict): if self.args.phase is None: raise MBErr('Must specify a build --phase for %s on %s' % - (self.args.builder, self.args.master)) + (self.args.builder, self.args.builder_group)) phase = str(self.args.phase) if phase not in config: raise MBErr('Phase %s doesn\'t exist for %s on %s' % - (phase, self.args.builder, self.args.master)) + (phase, self.args.builder, self.args.builder_group)) return config[phase] if self.args.phase is not None: raise MBErr('Must not specify a build --phase for %s on %s' % - (self.args.builder, self.args.master)) + (self.args.builder, self.args.builder_group)) return config def FlattenConfig(self, config): @@ -689,7 +692,8 @@ class MetaBuildWrapper(object): if 'args_file' in mixin_vals: if vals['args_file']: raise MBErr('args_file specified multiple times in mixins ' - 'for %s on %s' % (self.args.builder, self.args.master)) + 'for %s on %s' % + (self.args.builder, self.args.builder_group)) vals['args_file'] = mixin_vals['args_file'] if 'gn_args' in mixin_vals: if vals['gn_args']: @@ -1103,10 +1107,11 @@ class MetaBuildWrapper(object): raise MBErr('Error %s writing to the output path "%s"' % (e, path)) - def CheckCompile(self, master, builder): + def CheckCompile(self, builder_group, builder): url_template = self.args.url_template + '/{builder}/builds/_all?as_text=1' - url = urllib2.quote(url_template.format(master=master, builder=builder), - safe=':/()?=') + url = urllib2.quote( + url_template.format(builder_group=builder_group, builder=builder), + safe=':/()?=') try: builds = json.loads(self.Fetch(url)) except Exception as e: diff --git a/tools/mb/mb_unittest.py b/tools/mb/mb_unittest.py index 765cacbc58..4c67495de4 100755 --- a/tools/mb/mb_unittest.py +++ b/tools/mb/mb_unittest.py @@ -107,12 +107,12 @@ class FakeFile(object): TEST_CONFIG = """\ { - 'masters': { + 'builder_groups': { 'chromium': {}, - 'fake_master': { + 'fake_builder_group': { 'fake_builder': 'rel_bot', 'fake_debug_builder': 'debug_goma', - 'fake_args_bot': '//build/args/bots/fake_master/fake_args_bot.gn', + 'fake_args_bot': '//build/args/bots/fake_builder_group/fake_args_bot.gn', 'fake_multi_phase': { 'phase_1': 'phase_1', 'phase_2': 'phase_2'}, 'fake_args_file': 'args_file_goma', 'fake_args_file_twice': 'args_file_twice', @@ -155,7 +155,7 @@ TEST_CONFIG = """\ TRYSERVER_CONFIG = """\ { - 'masters': { + 'builder_groups': { 'not_a_tryserver': { 'fake_builder': 'fake_config', }, @@ -190,7 +190,7 @@ class UnitTest(unittest.TestCase): }, }''') mbw.files.setdefault( - mbw.ToAbsPath('//build/args/bots/fake_master/fake_args_bot.gn'), + mbw.ToAbsPath('//build/args/bots/fake_builder_group/fake_args_bot.gn'), 'is_debug = false\n') if files: for path, contents in files.items(): @@ -334,18 +334,18 @@ class UnitTest(unittest.TestCase): '--check\n', mbw.out) mbw = self.fake_mbw() - self.check(['gen', '-m', 'fake_master', '-b', 'fake_args_bot', + self.check(['gen', '-m', 'fake_builder_group', '-b', 'fake_args_bot', '//out/Debug'], mbw=mbw, ret=0) # TODO(almuthanna): disable test temporarily to # solve this issue https://crbug.com/v8/11102 # self.assertEqual( # mbw.files['/fake_src/out/Debug/args.gn'], - # 'import("//build/args/bots/fake_master/fake_args_bot.gn")\n') + # 'import("//build/args/bots/fake_builder_group/fake_args_bot.gn")\n') def test_gen_args_file_mixins(self): mbw = self.fake_mbw() - self.check(['gen', '-m', 'fake_master', '-b', 'fake_args_file', + self.check(['gen', '-m', 'fake_builder_group', '-b', 'fake_args_file', '//out/Debug'], mbw=mbw, ret=0) self.assertEqual( @@ -354,7 +354,7 @@ class UnitTest(unittest.TestCase): 'use_goma = true\n')) mbw = self.fake_mbw() - self.check(['gen', '-m', 'fake_master', '-b', 'fake_args_file_twice', + self.check(['gen', '-m', 'fake_builder_group', '-b', 'fake_args_file_twice', '//out/Debug'], mbw=mbw, ret=1) def test_gen_fails(self): @@ -582,26 +582,31 @@ class UnitTest(unittest.TestCase): def test_multiple_phases(self): # Check that not passing a --phase to a multi-phase builder fails. - mbw = self.check(['lookup', '-m', 'fake_master', '-b', 'fake_multi_phase'], + mbw = self.check(['lookup', '-m', 'fake_builder_group', + '-b', 'fake_multi_phase'], ret=1) self.assertIn('Must specify a build --phase', mbw.out) # Check that passing a --phase to a single-phase builder fails. - mbw = self.check(['lookup', '-m', 'fake_master', '-b', 'fake_builder', + mbw = self.check(['lookup', '-m', 'fake_builder_group', + '-b', 'fake_builder', '--phase', 'phase_1'], ret=1) self.assertIn('Must not specify a build --phase', mbw.out) # Check that passing a wrong phase key to a multi-phase builder fails. - mbw = self.check(['lookup', '-m', 'fake_master', '-b', 'fake_multi_phase', + mbw = self.check(['lookup', '-m', 'fake_builder_group', + '-b', 'fake_multi_phase', '--phase', 'wrong_phase'], ret=1) self.assertIn('Phase wrong_phase doesn\'t exist', mbw.out) # Check that passing a correct phase key to a multi-phase builder passes. - mbw = self.check(['lookup', '-m', 'fake_master', '-b', 'fake_multi_phase', + mbw = self.check(['lookup', '-m', 'fake_builder_group', + '-b', 'fake_multi_phase', '--phase', 'phase_1'], ret=0) self.assertIn('phase = 1', mbw.out) - mbw = self.check(['lookup', '-m', 'fake_master', '-b', 'fake_multi_phase', + mbw = self.check(['lookup', '-m', 'fake_builder_group', + '-b', 'fake_multi_phase', '--phase', 'phase_2'], ret=0) self.assertIn('phase = 2', mbw.out) @@ -612,7 +617,7 @@ class UnitTest(unittest.TestCase): 'enable_antidoom_banana = true\n' ) } - self.check(['lookup', '-m', 'fake_master', '-b', 'fake_args_file', + self.check(['lookup', '-m', 'fake_builder_group', '-b', 'fake_args_file', '--recursive'], files=files, ret=0, out=('enable_antidoom_banana = true\n' 'enable_doom_melon = true\n' @@ -633,9 +638,9 @@ class UnitTest(unittest.TestCase): '\tbuilder = luci_builder1\n' '[bucket "luci.luci_tryserver2"]\n' '\tbuilder = luci_builder2\n' - '[bucket "master.tryserver.chromium.linux"]\n' + '[bucket "builder_group.tryserver.chromium.linux"]\n' '\tbuilder = try_builder\n' - '[bucket "master.tryserver.chromium.mac"]\n' + '[bucket "builder_group.tryserver.chromium.mac"]\n' '\tbuilder = try_builder2\n'))