generate_buildbot_json: Enforce gn_isolate_map key <-> label consistency
gn_isolate_map.pyl currently requires the key name to match the GN
target name or things break in various ways. There was no
generation-time checks for this which lead to difficult to debug issues.
Add validation in generate_buildbot_json.py so to point people in the
right direction.
Bug: chromium:1071091
Change-Id: I0ae655d9b3add41e58fb9f2d6ac357c29d86af45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2162808
Commit-Queue: Kenneth Russell <[email protected]>
Auto-Submit: Corentin Wallez <[email protected]>
Reviewed-by: Kenneth Russell <[email protected]>
Cr-Commit-Position: refs/heads/master@{#762413}
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py
index 13de2ed0..135f7411 100755
--- a/testing/buildbot/generate_buildbot_json.py
+++ b/testing/buildbot/generate_buildbot_json.py
@@ -913,7 +913,20 @@
isolate_name = test.get('test') or test.get('isolate_name') or key
gn_entry = self.gn_isolate_map.get(isolate_name)
if gn_entry:
- test['test_target'] = gn_entry['label']
+ label = gn_entry['label']
+
+ if label.count(':') != 1:
+ raise BBGenErr(
+ 'Malformed GN label "%s" in gn_isolate_map for key "%s",'
+ ' implicit names (like //f/b meaning //f/b:b) are disallowed.' %
+ (label, isolate_name))
+ if label.split(':')[1] != isolate_name:
+ raise BBGenErr(
+ 'gn_isolate_map key name "%s" doesn\'t match GN target name in'
+ ' label "%s" see http://crbug.com/1071091 for details.' %
+ (isolate_name, label))
+
+ test['test_target'] = label
else: # pragma: no cover
# Some tests do not have an entry gn_isolate_map.pyl, such as
# telemetry tests.