builders.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. import re
  29. from webkitpy.common.memoized import memoized
  30. # In this dictionary, each item stores:
  31. # * port_name -- a fully qualified port name
  32. # * is_debug -- whether we are using a debug build
  33. # * move_overwritten_baselines_to -- (optional) list of platform directories that we will copy an existing
  34. # baseline to before pulling down a new baseline during rebaselining. This is useful
  35. # for bringing up a new port, for example when adding a Lion was the most recent Mac version and
  36. # we wanted to bring up Mountain Lion, we would want to copy an existing baseline in platform/mac
  37. # to platform/mac-mountainlion before updating the platform/mac entry.
  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 configurations; 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. _exact_matches = {
  43. # These builders are on build.webkit.org.
  44. "Apple MountainLion Release WK1 (Tests)": {"port_name": "mac-mountainlion", "is_debug": False, "rebaseline_override_dir": "mac"},
  45. "Apple MountainLion Debug WK1 (Tests)": {"port_name": "mac-mountainlion", "is_debug": True, "rebaseline_override_dir": "mac"},
  46. "Apple MountainLion Release WK2 (Tests)": {"port_name": "mac-mountainlion-wk2", "is_debug": False, "rebaseline_override_dir": "mac"},
  47. "Apple MountainLion Debug WK2 (Tests)": {"port_name": "mac-mountainlion-wk2", "is_debug": True, "rebaseline_override_dir": "mac"},
  48. "Apple Lion Release WK1 (Tests)": {"port_name": "mac-lion", "is_debug": False},
  49. "Apple Lion Debug WK1 (Tests)": {"port_name": "mac-lion", "is_debug": True},
  50. "Apple Lion Release WK2 (Tests)": {"port_name": "mac-lion-wk2", "is_debug": False},
  51. "Apple Lion Debug WK2 (Tests)": {"port_name": "mac-lion-wk2", "is_debug": True},
  52. "Apple Win XP Debug (Tests)": {"port_name": "win-xp", "is_debug": True},
  53. # FIXME: Remove rebaseline_override_dir once there is an Apple buildbot that corresponds to platform/win.
  54. "Apple Win 7 Release (Tests)": {"port_name": "win-7sp0", "is_debug": False, "rebaseline_override_dir": "win"},
  55. "GTK Linux 32-bit Release": {"port_name": "gtk", "is_debug": False},
  56. "GTK Linux 64-bit Debug": {"port_name": "gtk", "is_debug": True},
  57. "GTK Linux 64-bit Release": {"port_name": "gtk", "is_debug": False},
  58. "GTK Linux 64-bit Release WK2 (Tests)": {"port_name": "gtk-wk2", "is_debug": False},
  59. # FIXME: Remove rebaseline_override_dir once there are Qt bots for all the platform/qt-* directories.
  60. "Qt Linux Release": {"port_name": "qt-linux", "is_debug": False, "rebaseline_override_dir": "qt"},
  61. "EFL Linux 64-bit Release": {"port_name": "efl", "is_debug": False},
  62. "EFL Linux 64-bit Release WK2": {"port_name": "efl-wk2", "is_debug": False},
  63. "EFL Linux 64-bit Debug WK2": {"port_name": "efl-wk2", "is_debug": True},
  64. }
  65. _fuzzy_matches = {
  66. # These builders are on build.webkit.org.
  67. r"SnowLeopard": "mac-snowleopard",
  68. r"Apple Lion": "mac-lion",
  69. r"Windows": "win",
  70. r"GTK": "gtk",
  71. r"Qt": "qt",
  72. }
  73. _ports_without_builders = [
  74. "qt-mac",
  75. "qt-win",
  76. "qt-wk2",
  77. ]
  78. def builder_path_from_name(builder_name):
  79. return re.sub(r'[\s().]', '_', builder_name)
  80. def all_builder_names():
  81. return sorted(set(_exact_matches.keys()))
  82. def all_port_names():
  83. return sorted(set(map(lambda x: x["port_name"], _exact_matches.values()) + _ports_without_builders))
  84. def rebaseline_override_dir(builder_name):
  85. return _exact_matches[builder_name].get("rebaseline_override_dir", None)
  86. def move_overwritten_baselines_to(builder_name):
  87. return _exact_matches[builder_name].get("move_overwritten_baselines_to", [])
  88. def port_name_for_builder_name(builder_name):
  89. if builder_name in _exact_matches:
  90. return _exact_matches[builder_name]["port_name"]
  91. for regexp, port_name in _fuzzy_matches.items():
  92. if re.match(regexp, builder_name):
  93. return port_name
  94. def builder_name_for_port_name(target_port_name):
  95. debug_builder_name = None
  96. for builder_name, builder_info in _exact_matches.items():
  97. if builder_info['port_name'] == target_port_name:
  98. if builder_info['is_debug']:
  99. debug_builder_name = builder_name
  100. else:
  101. return builder_name
  102. return debug_builder_name
  103. def builder_path_for_port_name(port_name):
  104. builder_path_from_name(builder_name_for_port_name(port_name))