Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py

Issue 1939843002: Replace webkitpy standalone builders functions with instantiable class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
index 63220c727abb0b6d0789800b0953388dc1165e70..e28f114ee7f20ea2b90261718f7be24cc5792ebd 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
@@ -28,70 +28,73 @@
import re
-# In this dictionary, each item stores:
-# * port_name -- a fully qualified port name
-# * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
-# This is useful when we don't have bots that cover particular configurations; so, e.g., you might
-# support mac-mountainlion but not have a mac-mountainlion bot yet, so you'd want to put the mac-lion
-# results into platform/mac temporarily.
-# * specifiers -- TestExpectation specifiers for that config. Valid values are found in
-# TestExpectationsParser._configuration_tokens_list
-_exact_matches = {
- "WebKit Win7": {"port_name": "win-win7", "specifiers": ['Win7', 'Release']},
- "WebKit Win7 (dbg)": {"port_name": "win-win7", "specifiers": ['Win7', 'Debug']},
- "WebKit Win10": {"port_name": "win-win10", "specifiers": ['Win10', 'Release']},
- # FIXME: Rename this to 'WebKit Linux Precise'
- "WebKit Linux": {"port_name": "linux-precise", "specifiers": ['Precise', 'Release']},
- "WebKit Linux Trusty": {"port_name": "linux-trusty", "specifiers": ['Trusty', 'Release']},
- "WebKit Linux (dbg)": {"port_name": "linux-precise", "specifiers": ['Precise', 'Debug']},
- "WebKit Mac10.9": {"port_name": "mac-mac10.9", "specifiers": ['Mac10.9', 'Release']},
- "WebKit Mac10.10": {"port_name": "mac-mac10.10", "specifiers": ['Mac10.10', 'Release']},
- "WebKit Mac10.11": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Release']},
- "WebKit Mac10.11 (dbg)": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Debug']},
- "WebKit Mac10.11 (retina)": {"port_name": "mac-retina", "specifiers": ['Retina', 'Release']},
- "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": ['Android', 'Release']},
-}
-
-
-_ports_without_builders = [
-]
-
-
-def builder_path_from_name(builder_name):
- return re.sub(r'[\s().]', '_', builder_name)
-
-
-def all_builder_names():
- return sorted(set(_exact_matches.keys()))
-
-
-def all_port_names():
- return sorted(set(map(lambda x: x["port_name"], _exact_matches.values()) + _ports_without_builders))
-
-
-def rebaseline_override_dir(builder_name):
- return _exact_matches[builder_name].get("rebaseline_override_dir", None)
-
-
-def port_name_for_builder_name(builder_name):
- return _exact_matches[builder_name]["port_name"]
-
-
-def specifiers_for_builder(builder_name):
- return _exact_matches[builder_name]["specifiers"]
-
-
-def builder_name_for_port_name(target_port_name):
- debug_builder_name = None
- for builder_name, builder_info in _exact_matches.items():
- if builder_info['port_name'] == target_port_name:
- if 'dbg' in builder_name:
- debug_builder_name = builder_name
- else:
+class Builders(object):
+
qyearsley 2016/05/02 21:56:36 Optionally, here (or above) there could be a short
bokan 2016/05/04 11:58:47 I'm probably not the best person to do this since
Dirk Pranke 2016/05/04 22:42:36 Builders is the list of the main chromium builders
+ def __init__(self):
+
+ # In this dictionary, each item stores:
+ # * port_name -- a fully qualified port name
+ # * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
+ # This is useful when we don't have bots that cover particular configurations; so, e.g., you might
+ # support mac-mountainlion but not have a mac-mountainlion bot yet, so you'd want to put the mac-lion
+ # results into platform/mac temporarily.
+ # * specifiers -- TestExpectation specifiers for that config. Valid values are found in
+ # TestExpectationsParser._configuration_tokens_list
+ self._exact_matches = {
+ "WebKit Win7": {"port_name": "win-win7", "specifiers": ['Win7', 'Release']},
+ "WebKit Win7 (dbg)": {"port_name": "win-win7", "specifiers": ['Win7', 'Debug']},
+ "WebKit Win10": {"port_name": "win-win10", "specifiers": ['Win10', 'Release']},
+ # FIXME: Rename this to 'WebKit Linux Precise'
+ "WebKit Linux": {"port_name": "linux-precise", "specifiers": ['Precise', 'Release']},
+ "WebKit Linux Trusty": {"port_name": "linux-trusty", "specifiers": ['Trusty', 'Release']},
+ "WebKit Linux (dbg)": {"port_name": "linux-precise", "specifiers": ['Precise', 'Debug']},
+ "WebKit Mac10.9": {"port_name": "mac-mac10.9", "specifiers": ['Mac10.9', 'Release']},
+ "WebKit Mac10.10": {"port_name": "mac-mac10.10", "specifiers": ['Mac10.10', 'Release']},
+ "WebKit Mac10.11": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Release']},
+ "WebKit Mac10.11 (dbg)": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Debug']},
+ "WebKit Mac10.11 (retina)": {"port_name": "mac-retina", "specifiers": ['Retina', 'Release']},
+ "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": ['Android', 'Release']},
+ }
+
+ self._ports_without_builders = [
+ ]
+
+ def builder_path_from_name(self, builder_name):
+ return re.sub(r'[\s().]', '_', builder_name)
+
+ def all_builder_names(self):
+ return sorted(set(self._exact_matches.keys()))
+
+ def all_port_names(self):
+ return sorted(set(map(lambda x: x["port_name"], self._exact_matches.values()) + self._ports_without_builders))
+
+ def rebaseline_override_dir(self, builder_name):
Dirk Pranke 2016/05/03 23:16:38 I think we don't use rebaseline_override_dirs any
bokan 2016/05/04 11:58:47 It looks like there's a usage in rebaseline.py tha
Dirk Pranke 2016/05/04 22:42:36 I think they might be dead code, but am not positi
bokan 2016/05/05 14:20:54 Done. Filed crbug.com/609472
+ return self._exact_matches[builder_name].get("rebaseline_override_dir", None)
+
+ def port_name_for_builder_name(self, builder_name):
+ return self._exact_matches[builder_name]["port_name"]
+
+ def specifiers_for_builder(self, builder_name):
Dirk Pranke 2016/05/03 23:16:38 Is this function needed/used?
bokan 2016/05/04 11:58:47 In one place, BotTestExpectations uses it in __ini
Dirk Pranke 2016/05/04 22:42:36 Acknowledged.
+ return self._exact_matches[builder_name]["specifiers"]
+
+ def builder_name_for_port_name(self, target_port_name):
+ debug_builder_name = None
+ for builder_name, builder_info in self._exact_matches.items():
+ if builder_info['port_name'] == target_port_name:
+ if 'dbg' in builder_name:
+ debug_builder_name = builder_name
+ else:
+ return builder_name
+ return debug_builder_name
+
+ def builder_name_for_specifiers(self, version, build_type):
Dirk Pranke 2016/05/03 23:16:38 Is this function even needed/used? The prior versi
bokan 2016/05/04 11:58:47 Ah, yes, this was added and used in my update-test
+ for builder_name, info in self._exact_matches.items():
+ specifiers = info['specifiers']
+ if specifiers[0].lower() == version.lower() and specifiers[1].lower() == build_type.lower():
return builder_name
qyearsley 2016/05/02 21:56:36 Here we're implicitly requiring the specifiers lis
bokan 2016/05/04 11:58:47 Good point. I've removed this method for the purpo
- return debug_builder_name
+ return ''
-def builder_path_for_port_name(port_name):
- builder_path_from_name(builder_name_for_port_name(port_name))
+ def builder_path_for_port_name(self, port_name):
+ self.builder_path_from_name(self.builder_name_for_port_name(port_name))

Powered by Google App Engine
This is Rietveld 408576698