Commit ee622240 authored by Chong Gu's avatar Chong Gu Committed by Commit Bot

Add --isolate-map-file Flag to generate_buildbot_json.py script.

Add flag to allow generate_buildbot_json.py script to accept multiple gn isolate map files.

Bug: 1080853
Change-Id: I756cbce16923839ba1ca8fc00f8d67a8df04edbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504210
Commit-Queue: Chong Gu <chonggu@google.com>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#821799}
parent b79fecee
...@@ -314,6 +314,12 @@ class BBJSONGenerator(object): ...@@ -314,6 +314,12 @@ class BBJSONGenerator(object):
metavar='JSON_FILE_PATH', metavar='JSON_FILE_PATH',
help='Outputs results into a json file. Only works with query function.' help='Outputs results into a json file. Only works with query function.'
) )
parser.add_argument('--isolate-map-file',
metavar='PATH',
help='path to additional isolate map files.',
default=[],
action='append',
dest='isolate_map_files')
parser.add_argument( parser.add_argument(
'--infra-config-dir', '--infra-config-dir',
help='Path to the LUCI services configuration directory', help='Path to the LUCI services configuration directory',
...@@ -1120,6 +1126,14 @@ class BBJSONGenerator(object): ...@@ -1120,6 +1126,14 @@ class BBJSONGenerator(object):
self.exceptions = self.load_pyl_file('test_suite_exceptions.pyl') self.exceptions = self.load_pyl_file('test_suite_exceptions.pyl')
self.mixins = self.load_pyl_file('mixins.pyl') self.mixins = self.load_pyl_file('mixins.pyl')
self.gn_isolate_map = self.load_pyl_file('gn_isolate_map.pyl') self.gn_isolate_map = self.load_pyl_file('gn_isolate_map.pyl')
for isolate_map in self.args.isolate_map_files:
isolate_map = self.load_pyl_file(isolate_map)
duplicates = set(isolate_map).intersection(self.gn_isolate_map)
if duplicates:
raise BBGenErr('Duplicate targets in isolate map files: %s.' %
', '.join(duplicates))
self.gn_isolate_map.update(isolate_map)
self.variants = self.load_pyl_file('variants.pyl') self.variants = self.load_pyl_file('variants.pyl')
def resolve_configuration_files(self): def resolve_configuration_files(self):
......
...@@ -71,6 +71,7 @@ class FakeBBGen(generate_buildbot_json.BBJSONGenerator): ...@@ -71,6 +71,7 @@ class FakeBBGen(generate_buildbot_json.BBJSONGenerator):
(pyl_files_dir, 'test_suite_exceptions.pyl'): exceptions, (pyl_files_dir, 'test_suite_exceptions.pyl'): exceptions,
(pyl_files_dir, 'mixins.pyl'): mixins, (pyl_files_dir, 'mixins.pyl'): mixins,
(pyl_files_dir, 'gn_isolate_map.pyl'): gn_isolate_map, (pyl_files_dir, 'gn_isolate_map.pyl'): gn_isolate_map,
(pyl_files_dir, 'gn_isolate_map2.pyl'): GPU_TELEMETRY_GN_ISOLATE_MAP,
(pyl_files_dir, 'variants.pyl'): variants, (pyl_files_dir, 'variants.pyl'): variants,
(infra_config_dir, 'generated/project.pyl'): project_pyl, (infra_config_dir, 'generated/project.pyl'): project_pyl,
(infra_config_dir, 'generated/luci-milo.cfg'): luci_milo_cfg, (infra_config_dir, 'generated/luci-milo.cfg'): luci_milo_cfg,
...@@ -2231,6 +2232,32 @@ class UnitTest(TestCase): ...@@ -2231,6 +2232,32 @@ class UnitTest(TestCase):
fbb.check_output_file_consistency(verbose=True) fbb.check_output_file_consistency(verbose=True)
self.assertFalse(fbb.printed_lines) self.assertFalse(fbb.printed_lines)
def test_load_multiple_isolate_map_files_with_duplicates(self):
self.args.isolate_map_files = ['gn_isolate_map.pyl']
fbb = FakeBBGen(self.args,
FOO_GTESTS_WATERFALL,
REUSING_TEST_WITH_DIFFERENT_NAME,
LUCI_MILO_CFG,
gn_isolate_map=GN_ISOLATE_MAP)
with self.assertRaisesRegexp(generate_buildbot_json.BBGenErr,
'Duplicate targets in isolate map files.*'):
fbb.load_configuration_files()
def test_load_multiple_isolate_map_files_without_duplicates(self):
self.args.isolate_map_files = ['gn_isolate_map2.pyl']
fbb = FakeBBGen(self.args,
FOO_GTESTS_WATERFALL,
REUSING_TEST_WITH_DIFFERENT_NAME,
LUCI_MILO_CFG,
gn_isolate_map=GN_ISOLATE_MAP)
fbb.load_configuration_files()
isolate_dict = {}
isolate_map_1 = fbb.load_pyl_file('gn_isolate_map.pyl')
isolate_map_2 = fbb.load_pyl_file('gn_isolate_map2.pyl')
isolate_dict.update(isolate_map_1)
isolate_dict.update(isolate_map_2)
self.assertEquals(isolate_dict, fbb.gn_isolate_map)
def test_gn_isolate_map_with_label_mismatch(self): def test_gn_isolate_map_with_label_mismatch(self):
fbb = FakeBBGen(self.args, fbb = FakeBBGen(self.args,
FOO_GTESTS_WATERFALL, FOO_GTESTS_WATERFALL,
......
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