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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import re 29 import re
30 30
31 # In this dictionary, each item stores:
32 # * port_name -- a fully qualified port name
33 # * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
34 # This is useful when we don't have bots that cover particular configuratio ns; so, e.g., you might
35 # support mac-mountainlion but not have a mac-mountainlion bot yet, so you' d want to put the mac-lion
36 # results into platform/mac temporarily.
37 # * specifiers -- TestExpectation specifiers for that config. Valid values are f ound in
38 # TestExpectationsParser._configuration_tokens_list
39 31
40 _exact_matches = { 32 class Builders(object):
41 "WebKit Win7": {"port_name": "win-win7", "specifiers": ['Win7', 'Release']},
42 "WebKit Win7 (dbg)": {"port_name": "win-win7", "specifiers": ['Win7', 'Debug ']},
43 "WebKit Win10": {"port_name": "win-win10", "specifiers": ['Win10', 'Release' ]},
44 # FIXME: Rename this to 'WebKit Linux Precise'
45 "WebKit Linux": {"port_name": "linux-precise", "specifiers": ['Precise', 'Re lease']},
46 "WebKit Linux Trusty": {"port_name": "linux-trusty", "specifiers": ['Trusty' , 'Release']},
47 "WebKit Linux (dbg)": {"port_name": "linux-precise", "specifiers": ['Precise ', 'Debug']},
48 "WebKit Mac10.9": {"port_name": "mac-mac10.9", "specifiers": ['Mac10.9', 'Re lease']},
49 "WebKit Mac10.10": {"port_name": "mac-mac10.10", "specifiers": ['Mac10.10', 'Release']},
50 "WebKit Mac10.11": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Re lease']},
51 "WebKit Mac10.11 (dbg)": {"port_name": "mac-mac10.11", "specifiers": ['10.11 ', 'Debug']},
52 "WebKit Mac10.11 (retina)": {"port_name": "mac-retina", "specifiers": ['Reti na', 'Release']},
53 "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": ['Android' , 'Release']},
54 }
55 33
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
34 def __init__(self):
56 35
57 _ports_without_builders = [ 36 # In this dictionary, each item stores:
58 ] 37 # * port_name -- a fully qualified port name
38 # * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
39 # This is useful when we don't have bots that cover particular conf igurations; so, e.g., you might
40 # support mac-mountainlion but not have a mac-mountainlion bot yet, so you'd want to put the mac-lion
41 # results into platform/mac temporarily.
42 # * specifiers -- TestExpectation specifiers for that config. Valid valu es are found in
43 # TestExpectationsParser._configuration_tokens_list
44 self._exact_matches = {
45 "WebKit Win7": {"port_name": "win-win7", "specifiers": ['Win7', 'Rel ease']},
46 "WebKit Win7 (dbg)": {"port_name": "win-win7", "specifiers": ['Win7' , 'Debug']},
47 "WebKit Win10": {"port_name": "win-win10", "specifiers": ['Win10', ' Release']},
48 # FIXME: Rename this to 'WebKit Linux Precise'
49 "WebKit Linux": {"port_name": "linux-precise", "specifiers": ['Preci se', 'Release']},
50 "WebKit Linux Trusty": {"port_name": "linux-trusty", "specifiers": [ 'Trusty', 'Release']},
51 "WebKit Linux (dbg)": {"port_name": "linux-precise", "specifiers": [ 'Precise', 'Debug']},
52 "WebKit Mac10.9": {"port_name": "mac-mac10.9", "specifiers": ['Mac10 .9', 'Release']},
53 "WebKit Mac10.10": {"port_name": "mac-mac10.10", "specifiers": ['Mac 10.10', 'Release']},
54 "WebKit Mac10.11": {"port_name": "mac-mac10.11", "specifiers": ['10. 11', 'Release']},
55 "WebKit Mac10.11 (dbg)": {"port_name": "mac-mac10.11", "specifiers": ['10.11', 'Debug']},
56 "WebKit Mac10.11 (retina)": {"port_name": "mac-retina", "specifiers" : ['Retina', 'Release']},
57 "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": [' Android', 'Release']},
58 }
59 59
60 self._ports_without_builders = [
61 ]
60 62
61 def builder_path_from_name(builder_name): 63 def builder_path_from_name(self, builder_name):
62 return re.sub(r'[\s().]', '_', builder_name) 64 return re.sub(r'[\s().]', '_', builder_name)
63 65
66 def all_builder_names(self):
67 return sorted(set(self._exact_matches.keys()))
64 68
65 def all_builder_names(): 69 def all_port_names(self):
66 return sorted(set(_exact_matches.keys())) 70 return sorted(set(map(lambda x: x["port_name"], self._exact_matches.valu es()) + self._ports_without_builders))
67 71
72 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
73 return self._exact_matches[builder_name].get("rebaseline_override_dir", None)
68 74
69 def all_port_names(): 75 def port_name_for_builder_name(self, builder_name):
70 return sorted(set(map(lambda x: x["port_name"], _exact_matches.values()) + _ ports_without_builders)) 76 return self._exact_matches[builder_name]["port_name"]
71 77
78 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.
79 return self._exact_matches[builder_name]["specifiers"]
72 80
73 def rebaseline_override_dir(builder_name): 81 def builder_name_for_port_name(self, target_port_name):
74 return _exact_matches[builder_name].get("rebaseline_override_dir", None) 82 debug_builder_name = None
83 for builder_name, builder_info in self._exact_matches.items():
84 if builder_info['port_name'] == target_port_name:
85 if 'dbg' in builder_name:
86 debug_builder_name = builder_name
87 else:
88 return builder_name
89 return debug_builder_name
75 90
91 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
92 for builder_name, info in self._exact_matches.items():
93 specifiers = info['specifiers']
94 if specifiers[0].lower() == version.lower() and specifiers[1].lower( ) == build_type.lower():
95 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
76 96
77 def port_name_for_builder_name(builder_name): 97 return ''
78 return _exact_matches[builder_name]["port_name"]
79 98
80 99 def builder_path_for_port_name(self, port_name):
81 def specifiers_for_builder(builder_name): 100 self.builder_path_from_name(self.builder_name_for_port_name(port_name))
82 return _exact_matches[builder_name]["specifiers"]
83
84
85 def builder_name_for_port_name(target_port_name):
86 debug_builder_name = None
87 for builder_name, builder_info in _exact_matches.items():
88 if builder_info['port_name'] == target_port_name:
89 if 'dbg' in builder_name:
90 debug_builder_name = builder_name
91 else:
92 return builder_name
93 return debug_builder_name
94
95
96 def builder_path_for_port_name(port_name):
97 builder_path_from_name(builder_name_for_port_name(port_name))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698