• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2011 Google Inc. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are
5# met:
6#
7#     * Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9#     * Redistributions in binary form must reproduce the above
10# copyright notice, this list of conditions and the following disclaimer
11# in the documentation and/or other materials provided with the
12# distribution.
13#     * Neither the name of Google Inc. nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
28
29import re
30
31from webkitpy.common.memoized import memoized
32
33
34# In this dictionary, each item stores:
35# * port_name -- a fully qualified port name
36# * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
37#      This is useful when we don't have bots that cover particular configurations; so, e.g., you might
38#      support mac-mountainlion but not have a mac-mountainlion bot yet, so you'd want to put the mac-lion
39#      results into platform/mac temporarily.
40# * specifiers -- TestExpectation specifiers for that config. Valid values are found in
41#      TestExpectationsParser._configuration_tokens_list
42
43_exact_matches = {
44    "WebKit XP": {"port_name": "win-xp", "specifiers": ['XP', 'Release']},
45    "WebKit Win7": {"port_name": "win-win7", "specifiers": ['Win7', 'Release']},
46    "WebKit Win7 (dbg)": {"port_name": "win-win7", "specifiers": ['Win7', 'Debug']},
47    "WebKit Linux": {"port_name": "linux-x86_64", "specifiers": ['Linux', 'Release']},
48    "WebKit Linux 32": {"port_name": "linux-x86", "specifiers": ['Linux', 'Release']},
49    "WebKit Linux (dbg)": {"port_name": "linux-x86_64", "specifiers": ['Linux', 'Debug']},
50    "WebKit Mac10.6": {"port_name": "mac-snowleopard", "specifiers": ['SnowLeopard', 'Release']},
51    "WebKit Mac10.6 (dbg)": {"port_name": "mac-snowleopard", "specifiers": ['SnowLeopard', 'Debug']},
52    "WebKit Mac10.7": {"port_name": "mac-lion", "specifiers": ['Lion', 'Release']},
53    "WebKit Mac10.7 (dbg)": {"port_name": "mac-lion", "specifiers": ['Lion', 'Debug']},
54    "WebKit Mac10.8": {"port_name": "mac-mountainlion", "specifiers": ['MountainLion', 'Release']},
55    "WebKit Mac10.8 (retina)": {"port_name": "mac-retina", "specifiers": ['Retina', 'Release']},
56    "WebKit Mac10.9": {"port_name": "mac-mavericks", "specifiers": ['Mavericks', 'Release']},
57    "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": ['Android', 'Release']},
58}
59
60
61# Mapping from port name to the deps builder of the same os:
62_deps_builders = {
63    "linux-x86": "WebKit Linux (deps)",
64    "linux-x86_64": "WebKit Linux (deps)",
65    "win-xp": "WebKit XP (deps)",
66    "win-win7": "WebKit XP (deps)",
67    "mac-snowleopard": "WebKit Mac10.6 (deps)",
68    "mac-lion": "WebKit Mac10.6 (deps)",
69    "mac-mountainlion": "WebKit Mac10.6 (deps)",
70    "mac-mavericks": "WebKit Mac10.6 (deps)",
71    "mac-retina": "WebKit Mac10.6 (deps)",
72}
73
74
75_ports_without_builders = [
76]
77
78
79def builder_path_from_name(builder_name):
80    return re.sub(r'[\s().]', '_', builder_name)
81
82
83def all_builder_names():
84    return sorted(set(_exact_matches.keys()))
85
86
87def all_port_names():
88    return sorted(set(map(lambda x: x["port_name"], _exact_matches.values()) + _ports_without_builders))
89
90
91def rebaseline_override_dir(builder_name):
92    return _exact_matches[builder_name].get("rebaseline_override_dir", None)
93
94
95def port_name_for_builder_name(builder_name):
96    return _exact_matches[builder_name]["port_name"]
97
98
99def specifiers_for_builder(builder_name):
100    return _exact_matches[builder_name]["specifiers"]
101
102
103def builder_name_for_port_name(target_port_name):
104    debug_builder_name = None
105    for builder_name, builder_info in _exact_matches.items():
106        if builder_info['port_name'] == target_port_name:
107            if 'dbg' in builder_name:
108                debug_builder_name = builder_name
109            else:
110                return builder_name
111    return debug_builder_name
112
113
114def builder_path_for_port_name(port_name):
115    builder_path_from_name(builder_name_for_port_name(port_name))
116
117
118def deps_builder_name_for_port_name(target_port_name):
119    return _deps_builders.get(target_port_name, None)
120