Tools/ChangeLog

 12011-07-13 Eric Seidel <eric@webkit.org>
 2
 3 new-run-webkit-tests has incorrect fallback for win port
 4 https://bugs.webkit.org/show_bug.cgi?id=64439
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This patch ended up too big and I'm going to need to break it up.
 9
 10 The main goal was to fix Win port fallback paths (which I succeeded).
 11 However I also went ahead and changed port.get to know how to
 12 set the version and operating_system on the port object after creation.
 13 This makes all the WebKitPort constructors much simpler since they no
 14 longer have to support parsing the port_name argument.
 15
 16 * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
 17 - Just a FIXME and linewrapping.
 18 * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
 19 - More linewrapping.
 20 * Scripts/webkitpy/layout_tests/port/base.py:
 21 - Add port_name_with_version and a FIXME about how name() is meaningless/misused.
 22 * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
 23 - Move os_version here now that the Mac port uses something nicer.
 24 * Scripts/webkitpy/layout_tests/port/chromium_win.py:
 25 - Clean up some code/FIXMEs including adding a _chromium_cygwin_path helper.
 26 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
 27 - Linewrapping
 28 * Scripts/webkitpy/layout_tests/port/dryrun.py:
 29 - Adding a port_name makes lookup easier.
 30 * Scripts/webkitpy/layout_tests/port/factory.py:
 31 - Add a _PortFactory class and split the get() method down into pieces.
 32 - I also re-wrote how get() works for WebKit ports. Now the factory is
 33 responsible for setting version and operating_system information on
 34 the port instead of the Port constructor parsing those values from
 35 the port_name. Chromium ports and test ports are unchanged.
 36 * Scripts/webkitpy/layout_tests/port/mac.py:
 37 - Re-write fallback to work more like ORWT does (and the Win port does)
 38 with a single fallback list instead of dictionary of lists.
 39 * Scripts/webkitpy/layout_tests/port/mac_unittest.py:
 40 - Test wk2 skipped list fallback. (It worked before but was untested.)
 41 - Remove poorly factored tests for version lookup, and add a new test
 42 which calls into _version_string_from_mac_ver_tuple directly.
 43 * Scripts/webkitpy/layout_tests/port/mock_drt.py:
 44 - port_names make everything better.
 45 * Scripts/webkitpy/layout_tests/port/qt.py:
 46 - Add SUPPORTED_OPERATING_SYSTEMS so that factory.py can correctly parse
 47 qt-win, etc.
 48 * Scripts/webkitpy/layout_tests/port/qt_unittest.py:
 49 - Remove incorrect FIXME.
 50 * Scripts/webkitpy/layout_tests/port/test.py:
 51 - Another port_name addition.
 52 * Scripts/webkitpy/layout_tests/port/webkit.py:
 53 - Remove usage of port_name from WebKit ports.
 54 * Scripts/webkitpy/layout_tests/port/win.py:
 55 - Add support for windows version detection matching old-run-webkit-tests.
 56 - Add support for windows results fallback (modeled after how ORWT did fallback).
 57 * Scripts/webkitpy/layout_tests/port/win_unittest.py: Copied from Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py.
 58 - Test our new fallback code.
 59 * Scripts/webkitpy/tool/commands/rebaseline.py:
 60 - Add a FIXME.
 61
1622011-07-12 Joseph Pecoraro <joepeck@webkit.org>
263
364 ApplicationCache update should not immediately fail when reaching per-origin quota

Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py

@@if multiprocessing:
253253
254254 def run(self):
255255 options = self._options
 256 # FIXME: This should pass an Executive, User, and FileSystem from the tool.
256257 port_obj = layout_tests.port.get(self._platform_name, options)
257258
258259 # The unix multiprocessing implementation clones the

@@if multiprocessing:
263264 # FIXME: this won't work if the calling process is logging
264265 # somewhere other than sys.stderr and sys.stdout, but I'm not sure
265266 # if this will be an issue in practice.
266  printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout,
267  configure_logging)
 267 printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging)
268268 self._client.run(port_obj)
269269 printer.cleanup()
270270

Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py

@@def get_options(worker_model):
114114 return options
115115
116116
117 
118117class FunctionTests(unittest.TestCase):
119118 def test_get__inline(self):
120119 self.assertTrue(make_broker(self, 'inline') is not None)

@@class _TestsMixin(object):
163162 self._worker_model = None
164163
165164 def make_broker(self, starting_queue=None, stopping_queue=None):
166  self._broker = make_broker(self, self._worker_model, starting_queue,
167  stopping_queue)
 165 self._broker = make_broker(self, self._worker_model, starting_queue, stopping_queue)
168166
169167 def test_cancel(self):
170168 self.make_broker()

Tools/Scripts/webkitpy/layout_tests/port/base.py

@@class Port(object):
542542 """Creates the specified directory if it doesn't already exist."""
543543 self._filesystem.maybe_make_directory(*comps)
544544
 545 # FIXME: This should be renamed to express exactly what kind of name this is.
 546 # self._name can be set to an arbitrary value, yet many callers (wrongly)
 547 # assume name() will always the name matching LayoutTests/platform/PORT_NAME (aka baseline_path()).
545548 def name(self):
546549 """Returns a name that uniquely identifies this particular type of port
547550 (e.g., "mac-snowleopard" or "chromium-gpu-linux-x86_x64" and can be passed
548551 to factory.get() to instantiate the port."""
549552 return self._name
550553
 554 # This should be identical to name() for all WebKit ports, but is more clear what it returns as name() can be set to anything.
 555 # FIXME: Eventually we need to standarize naming across ports and remove all callers of name().
 556 def cannonical_name(self):
 557 components = [self.port_name]
 558 if self._operating_system:
 559 components.append(self._operating_system)
 560 if self._version: # This is os_version
 561 components.append(self._version)
 562 return "-".join(components)
 563
551564 def real_name(self):
552565 # FIXME: Seems this is only used for MockDRT and should be removed.
553566 """Returns the name of the port as passed to the --platform command line argument."""

Tools/Scripts/webkitpy/layout_tests/port/chromium.py

@@class ChromiumPort(Port):
330330 pass
331331 return True
332332
333  def _chromium_baseline_path(self, platform):
334  if platform is None:
335  platform = self.name()
336  return self.path_from_webkit_base('LayoutTests', 'platform', platform)
337 
338333 def _convert_path(self, path):
339334 """Handles filename conversion for subprocess command line args."""
340335 # See note above in diff_image() for why we need this.

Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py

3030"""Chromium Mac implementation of the Port interface."""
3131
3232import logging
 33import platform
3334import os
3435import signal
3536

@@from webkitpy.common.system.executive import Executive
4243_log = logging.getLogger(__name__)
4344
4445
 46# FIXME: This method mixes testing code and release code. ChromiumMac
 47# should move to a version detection strategy closer to the one in mac.py.
 48def os_version(os_version_string=None, supported_versions=None):
 49 if not os_version_string:
 50 if hasattr(platform, 'mac_ver') and platform.mac_ver()[0]:
 51 os_version_string = platform.mac_ver()[0]
 52 else:
 53 # Make up something for testing.
 54 os_version_string = "10.5.6"
 55 release_version = int(os_version_string.split('.')[1])
 56 version_strings = {
 57 5: 'leopard',
 58 6: 'snowleopard',
 59 # Add 7: 'lion' here?
 60 }
 61 assert release_version >= min(version_strings.keys())
 62 version_string = version_strings.get(release_version, 'future')
 63 if supported_versions:
 64 assert version_string in supported_versions
 65 return version_string
 66
 67
4568class ChromiumMacPort(chromium.ChromiumPort):
4669 """Chromium Mac implementation of the Port class."""
4770 SUPPORTED_OS_VERSIONS = ('leopard', 'snowleopard', 'future')

@@class ChromiumMacPort(chromium.ChromiumPort):
7497 port_name = port_name or 'chromium-mac'
7598 chromium.ChromiumPort.__init__(self, port_name=port_name, **kwargs)
7699 if port_name.endswith('-mac'):
77  self._version = mac.os_version(os_version_string, self.SUPPORTED_OS_VERSIONS)
 100 self._version = os_version(os_version_string, self.SUPPORTED_OS_VERSIONS)
78101 self._name = port_name + '-' + self._version
79102 else:
80103 self._version = port_name[port_name.index('-mac-') + len('-mac-'):]

Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py

@@import chromium
3838_log = logging.getLogger(__name__)
3939
4040
 41# FIXME: This belongs on some sort of platform object to be shared between other ports.
4142def os_version(windows_version=None):
4243 if not windows_version:
4344 if hasattr(sys, 'getwindowsversion'):
4445 windows_version = tuple(sys.getwindowsversion()[:2])
4546 else:
46  # Make up something for testing.
 47 # This code exists to make it possible to instantiate a ChromiumWinPort object from non-windows platform.
4748 windows_version = (5, 1)
4849
4950 version_strings = {

@@def os_version(windows_version=None):
5556
5657
5758class ChromiumWinPort(chromium.ChromiumPort):
58  """Chromium Win implementation of the Port class."""
59 
6059 # FIXME: Figure out how to unify this with base.TestConfiguration.all_systems()?
6160 SUPPORTED_VERSIONS = ('xp', 'vista', 'win7')
6261

@@class ChromiumWinPort(chromium.ChromiumPort):
9897 assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (self._version, self.SUPPORTED_VERSIONS)
9998 self._operating_system = 'win'
10099
 100 def _chromium_cygwin_path(self, *comps):
 101 return self.path_from_chromium_base("third_party", "cygwin", *comps)
 102
101103 def setup_environ_for_server(self):
102104 env = chromium.ChromiumPort.setup_environ_for_server(self)
103105 # Put the cygwin directory first in the path to find cygwin1.dll.
104  env["PATH"] = "%s;%s" % (
105  self.path_from_chromium_base("third_party", "cygwin", "bin"),
106  env["PATH"])
 106 env["PATH"] = "%s;%s" % (self._chromium_cygwin_path("bin"), env["PATH"])
107107 # Configure the cygwin directory so that pywebsocket finds proper
108108 # python executable to run cgi program.
109  env["CYGWIN_PATH"] = self.path_from_chromium_base(
110  "third_party", "cygwin", "bin")
 109 env["CYGWIN_PATH"] = self._chromium_cygwin_path("bin")
111110 if (sys.platform in ("cygwin", "win32") and self.get_option('register_cygwin')):
112  setup_mount = self.path_from_chromium_base("third_party",
113  "cygwin",
114  "setup_mount.bat")
 111 setup_mount = self._chromium_cygwin_path("setup_mount.bat")
115112 self._executive.run_command([setup_mount])
116113 return env
117114

@@class ChromiumWinPort(chromium.ChromiumPort):
122119 def check_build(self, needs_http):
123120 result = chromium.ChromiumPort.check_build(self, needs_http)
124121 if not result:
125  _log.error('For complete Windows build requirements, please '
126  'see:')
 122 _log.error('For complete Windows build requirements, please see:')
127123 _log.error('')
128  _log.error(' http://dev.chromium.org/developers/how-tos/'
129  'build-instructions-windows')
 124 _log.error(' http://dev.chromium.org/developers/how-tos/build-instructions-windows')
130125 return result
131126
132127 def relative_test_filename(self, filename):

@@class ChromiumWinPort(chromium.ChromiumPort):
138133 #
139134 def _build_path(self, *comps):
140135 if self.get_option('build_directory'):
141  return self._filesystem.join(self.get_option('build_directory'),
142  *comps)
 136 return self._filesystem.join(self.get_option('build_directory'), *comps)
143137
144138 p = self.path_from_chromium_base('webkit', *comps)
145139 if self._filesystem.exists(p):

@@class ChromiumWinPort(chromium.ChromiumPort):
153147 return False
154148
155149 def _lighttpd_path(self, *comps):
156  return self.path_from_chromium_base('third_party', 'lighttpd', 'win',
157  *comps)
 150 return self.path_from_chromium_base('third_party', 'lighttpd', 'win', *comps)
158151
159152 def _path_to_apache(self):
160  return self.path_from_chromium_base('third_party', 'cygwin', 'usr',
161  'sbin', 'httpd')
 153 return self._chromium_cygwin_path('usr', 'sbin', 'httpd')
162154
163155 def _path_to_apache_config_file(self):
164156 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'cygwin-httpd.conf')

@@class ChromiumWinPort(chromium.ChromiumPort):
187179 return self._build_path(self.get_option('configuration'), binary_name)
188180
189181 def _path_to_wdiff(self):
190  return self.path_from_chromium_base('third_party', 'cygwin', 'bin',
191  'wdiff.exe')
 182 return self.self._chromium_cygwin_path('bin', 'wdiff.exe')

Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py

@@class ChromiumWinTest(port_testcase.PortTestCase):
9696 expected_stderr=expected_stderr)
9797
9898 def assert_name(self, port_name, windows_version, expected):
99  port = chromium_win.ChromiumWinPort(port_name=port_name,
100  windows_version=windows_version)
 99 port = chromium_win.ChromiumWinPort(port_name=port_name, windows_version=windows_version)
101100 self.assertEquals(expected, port.name())
102101
103102 def test_versions(self):

Tools/Scripts/webkitpy/layout_tests/port/dryrun.py

@@from webkitpy.layout_tests.port import Driver, DriverOutput, factory
5555
5656# FIXME: Why not inherit from Port?
5757class DryRunPort(object):
58  """DryRun implementation of the Port interface."""
 58 port_name = 'dryrun'
5959
6060 def __init__(self, **kwargs):
6161 pfx = 'dryrun-'

Tools/Scripts/webkitpy/layout_tests/port/factory.py

2727# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
30 """Factory method to retrieve the appropriate port implementation."""
31 
32 
3330import sys
3431
3532from webkitpy.layout_tests.port import builders

@@def all_port_names():
4542 return builders.PORT_TO_BUILDER_NAME.keys()
4643
4744
48 def get(port_name=None, options=None, **kwargs):
 45def get(port_name=None, options=None, **port_args):
4946 """Returns an object implementing the Port interface. If
5047 port_name is None, this routine attempts to guess at the most
5148 appropriate port on this platform."""
52  # Wrapped for backwards-compatibility
53  if port_name:
54  kwargs['port_name'] = port_name
5549 if options:
56  kwargs['options'] = options
57  return _get_kwargs(**kwargs)
 50 port_args['options'] = options
 51 return _PortFactory().port_from_commandline_name_and_options(port_name, **port_args)
5852
5953
60 def _get_kwargs(**kwargs):
61  port_to_use = kwargs.get('port_name', None)
62  options = kwargs.get('options', None)
63  if port_to_use is None:
 54class _PortFactory(object):
 55 def _commandline_name_from_options(self, options):
 56 use_chromium_port = options and hasattr(options, 'chromium') and options.chromium
6457 if sys.platform == 'win32' or sys.platform == 'cygwin':
65  if options and hasattr(options, 'chromium') and options.chromium:
66  port_to_use = 'chromium-win'
67  else:
68  port_to_use = 'win'
69  elif sys.platform.startswith('linux'):
70  port_to_use = 'chromium-linux'
71  elif sys.platform == 'darwin':
72  if options and hasattr(options, 'chromium') and options.chromium:
73  port_to_use = 'chromium-mac'
 58 return 'chromium-win' if use_chromium_port else 'win'
 59 if sys.platform.startswith('linux'):
 60 # FIXME: This is wrong, we need to support --qt and --gtk options.
 61 # https://bugs.webkit.org/show_bug.cgi?id=63970
 62 return 'chromium-linux'
 63 if sys.platform == 'darwin':
 64 return 'chromium-mac' if use_chromium_port else 'mac'
 65 return None
 66
 67 def _construct_port_from_name_components(self, port_class, name_components, port_args):
 68 port = port_class(**port_args)
 69
 70 for component in name_components:
 71 # FIXME: _version and _operating_system should be made public members.
 72 if component in port.SUPPORTED_OS_VERSIONS:
 73 # The port constructor may have auto-detected a specific version, the commandline_name components should override it.
 74 port._version = component
 75 elif component in port.SUPPORTED_OPERATING_SYSTEMS:
 76 port._operating_system = component
 77 # FIXME: When we move Chromium ports to use factory-based component-parsing we will
 78 # need to add support for SUPPORTED_GRAPHICS and SUPPORTED_ARCHITECTURES.
7479 else:
75  port_to_use = 'mac'
76 
77  if port_to_use is None:
78  raise NotImplementedError('unknown port; sys.platform = "%s"' % sys.platform)
79 
80  if port_to_use.startswith('test'):
81  import test
82  maker = test.TestPort
83  elif port_to_use.startswith('dryrun'):
84  import dryrun
85  maker = dryrun.DryRunPort
86  elif port_to_use.startswith('mock-'):
87  import mock_drt
88  maker = mock_drt.MockDRTPort
89  elif port_to_use.startswith('mac'):
90  import mac
91  maker = mac.MacPort
92  elif port_to_use.startswith('win'):
93  import win
94  maker = win.WinPort
95  elif port_to_use.startswith('gtk'):
96  import gtk
97  maker = gtk.GtkPort
98  elif port_to_use.startswith('qt'):
99  import qt
100  maker = qt.QtPort
101  elif port_to_use.startswith('chromium-gpu'):
102  import chromium_gpu
103  maker = chromium_gpu.get
104  elif port_to_use.startswith('chromium-mac'):
105  import chromium_mac
106  maker = chromium_mac.ChromiumMacPort
107  elif port_to_use.startswith('chromium-linux'):
108  import chromium_linux
109  maker = chromium_linux.ChromiumLinuxPort
110  elif port_to_use.startswith('chromium-win'):
111  import chromium_win
112  maker = chromium_win.ChromiumWinPort
113  elif port_to_use.startswith('google-chrome'):
114  import google_chrome
115  maker = google_chrome.GetGoogleChromePort
116  else:
117  raise NotImplementedError('unsupported port: %s' % port_to_use)
118  return maker(**kwargs)
 80 raise NotImplementedError('Port %s does not understand component "%s" in name "%s".' % (port.port_name, component, '-'.join([port.port_name] + name_components)))
 81 # FIXME: name() should be removed, but for now we need to update it after possibly changing _version.
 82 port._name = port.cannonical_name()
 83 return port
 84
 85 def _port_maker_for_chromium_port(self, commandline_name):
 86 if commandline_name.startswith('chromium-mac'):
 87 import chromium_mac
 88 return chromium_mac.ChromiumMacPort
 89 if commandline_name.startswith('chromium-linux'):
 90 import chromium_linux
 91 return chromium_linux.ChromiumLinuxPort
 92 if commandline_name.startswith('chromium-win'):
 93 import chromium_win
 94 return chromium_win.ChromiumWinPort
 95 if commandline_name.startswith('chromium-gpu'):
 96 import chromium_gpu
 97 return chromium_gpu.get
 98 if commandline_name.startswith('google-chrome'):
 99 import google_chrome
 100 return google_chrome.GetGoogleChromePort
 101 return None
 102
 103 # This creates a Port object, given a port-name provided by --platform=
 104 # which may include version, architecture, gpu, and other information
 105 # that may not be included in the official name of the port ('mac', 'chromium', etc.)
 106 # or the names seen in LayoutTests/platform/*.
 107 def port_from_commandline_name_and_options(self, commandline_name=None, **port_args):
 108 commandline_name = commandline_name or self._commandline_name_from_options(port_args.get('options'))
 109 if not commandline_name:
 110 raise NotImplementedError('Unknown port; sys.platform = "%s"' % sys.platform)
 111
 112 name_components = commandline_name.split('-')
 113
 114 # These are imported here to avoid circular imports in ports/__init__.py
 115 # The correct long-term fix is likely to remove the import of this file from __init__.py
 116 from webkitpy.layout_tests.port import qt, gtk, win, mac, test, dryrun, mock_drt
 117
 118 for port_class in (mac.MacPort, win.WinPort, gtk.GtkPort, qt.QtPort):
 119 if name_components[0] == port_class.port_name:
 120 return self._construct_port_from_name_components(port_class, name_components[1:], port_args)
 121
 122 # Test and Chromium ports still expect a port_name argument to their constructors.
 123 if commandline_name:
 124 port_args['port_name'] = commandline_name
 125
 126 for port_class in (test.TestPort, dryrun.DryRunPort, mock_drt.MockDRTPort):
 127 if name_components[0] == port_class.port_name:
 128 # Test ports have special port_name parsing in the various Port constructors.
 129 return port_class(**port_args)
 130
 131 # Chromium ports use custom port contructors to handle crazy things like gpu and google-branded results.
 132 # Eventually this should be moved closer to what WebKit ports do.
 133 maker = self._port_maker_for_chromium_port(commandline_name)
 134 if not maker:
 135 raise NotImplementedError('unsupported port: %s' % commandline_name)
 136 return maker(**port_args)

Tools/Scripts/webkitpy/layout_tests/port/mac.py

@@from webkitpy.layout_tests.port.webkit import WebKitPort
3838_log = logging.getLogger(__name__)
3939
4040
41 def os_version(os_version_string=None, supported_versions=None):
42  if not os_version_string:
43  if hasattr(platform, 'mac_ver') and platform.mac_ver()[0]:
44  os_version_string = platform.mac_ver()[0]
45  else:
46  # Make up something for testing.
47  os_version_string = "10.5.6"
48  release_version = int(os_version_string.split('.')[1])
49  version_strings = {
50  5: 'leopard',
51  6: 'snowleopard',
52  # Add 7: 'lion' here?
53  }
54  assert release_version >= min(version_strings.keys())
55  version_string = version_strings.get(release_version, 'future')
56  if supported_versions:
57  assert version_string in supported_versions
58  return version_string
59 
60 
6141class MacPort(WebKitPort):
6242 port_name = "mac"
6343
64  # FIXME: 'wk2' probably shouldn't be a version, it should probably be
65  # a modifier, like 'chromium-gpu' is to 'chromium'.
66  SUPPORTED_VERSIONS = ('leopard', 'snowleopard', 'future', 'wk2')
67 
68  FALLBACK_PATHS = {
69  'leopard': [
70  'mac-leopard',
71  'mac-snowleopard',
72  'mac',
73  ],
74  'snowleopard': [
75  'mac-snowleopard',
76  'mac',
77  ],
78  'future': [
79  'mac',
80  ],
81  'wk2': [], # wk2 does not make sense as a version, this is only here to make the rebaseline unit tests not crash.
82  }
83 
84  def __init__(self, port_name=None, os_version_string=None, **kwargs):
85  port_name = port_name or 'mac'
86  WebKitPort.__init__(self, port_name=port_name, **kwargs)
87  if port_name == 'mac':
88  self._version = os_version(os_version_string)
89  self._name = port_name + '-' + self._version
90  else:
91  assert port_name.startswith('mac')
92  self._version = port_name[len('mac-'):]
93  assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (self._version, self.SUPPORTED_VERSIONS)
 44 SUPPORTED_OS_VERSIONS = frozenset(['leopard', 'snowleopard'])
 45 VERSION_FALLBACK_ORDER = ('mac-leopard', 'mac-snowleopard', 'mac')
 46
 47 def _version_string_from_mac_ver_tuple(self, mac_ver_tuple):
 48 release_string = mac_ver_tuple[0]
 49 if not release_string:
 50 return None
 51 release_version = int(release_string.split('.')[1])
 52 version_strings = {
 53 5: 'leopard',
 54 6: 'snowleopard',
 55 # FIXME: When Apple commits mac-lion they'll want to add 'lion' here.
 56 }
 57 return version_strings.get(release_version)
 58
 59 def _detect_version(self):
 60 if not hasattr(platform, 'mac_ver'):
 61 return None
 62 return self._version_string_from_mac_ver_tuple(platform.mac_ver())
 63
 64 def __init__(self, os_version_string=None, **kwargs):
 65 WebKitPort.__init__(self, **kwargs)
 66 self._version = os_version_string or self._detect_version()
 67 self._name = self.cannonical_name()
9468 self._operating_system = 'mac'
9569
9670 def baseline_search_path(self):
97  search_paths = self.FALLBACK_PATHS[self._version]
 71 try:
 72 fallback_index = self.VERSION_FALLBACK_ORDER.index(self.cannonical_name())
 73 fallback_names = list(self.VERSION_FALLBACK_ORDER[fallback_index:])
 74 except ValueError:
 75 # Unknown versions just fall back to the base port results.
 76 fallback_names = [self.port_name]
9877 if self.get_option('webkit_test_runner'):
99  search_paths.insert(0, self._wk2_port_name())
100  return map(self._webkit_baseline_path, search_paths)
 78 fallback_names.insert(0, 'mac-wk2')
 79 # Note we do not add 'wk2' here, even though it's included in _skipped_search_paths().
 80 return map(self._webkit_baseline_path, fallback_names)
10181
10282 def is_crash_reporter(self, process_name):
10383 return re.search(r'ReportCrash', process_name)

Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py

@@class MacTest(port_testcase.PortTestCase):
4444 return None
4545 return MacPort
4646
47  def assert_skipped_file_search_paths(self, port_name, expected_paths):
48  port = MacPort(port_name=port_name, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
 47 def assert_skipped_file_search_paths(self, version, expected_paths, use_webkit2=False):
 48 port = MacPort(os_version_string=version, options=MockOptions(webkit_test_runner=use_webkit2), filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
4949 self.assertEqual(port._skipped_file_search_paths(), expected_paths)
5050
5151 def test_skipped_file_search_paths(self):

@@class MacTest(port_testcase.PortTestCase):
5353 if sys.platform == 'win32':
5454 return None
5555
56  self.assert_skipped_file_search_paths('mac-snowleopard', set(['mac-snowleopard', 'mac']))
57  self.assert_skipped_file_search_paths('mac-leopard', set(['mac-leopard', 'mac']))
 56 self.assert_skipped_file_search_paths('snowleopard', set(['mac-snowleopard', 'mac']))
 57 self.assert_skipped_file_search_paths('leopard', set(['mac-leopard', 'mac']))
 58
 59 # Note how the Skipped search paths include 'wk2' even though baseline_search_path does not.
 60 self.assert_skipped_file_search_paths('snowleopard', set(['mac-snowleopard', 'mac', 'mac-wk2', 'wk2']), use_webkit2=True)
 61 self.assert_skipped_file_search_paths('leopard', set(['mac-leopard', 'mac', 'mac-wk2', 'wk2']), use_webkit2=True)
 62
5863 # We cannot test just "mac" here as the MacPort constructor automatically fills in the version from the running OS.
5964 # self.assert_skipped_file_search_paths('mac', ['mac'])
6065

@@svg/batik/text/smallFonts.svg
7984 port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
8085 self.assertEqual(port._tests_from_skipped_file_contents(self.example_skipped_file), self.example_skipped_tests)
8186
82  def assert_name(self, port_name, os_version_string, expected):
83  port = MacPort(port_name=port_name, os_version_string=os_version_string, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
84  self.assertEquals(expected, port.name())
85 
8687 def test_tests_for_other_platforms(self):
8788 platforms = ['mac', 'chromium-linux', 'mac-snowleopard']
88  port = MacPort(port_name='mac-snowleopard', filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
 89 port = MacPort(os_version_string='snowleopard', filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
8990 platform_dir_paths = map(port._webkit_baseline_path, platforms)
9091 # Replace our empty mock file system with one which has our expected platform directories.
9192 port._filesystem = MockFileSystem(dirs=platform_dir_paths)

@@svg/batik/text/smallFonts.svg
9596 self.assertFalse('platform/mac' in dirs_to_skip)
9697 self.assertFalse('platform/mac-snowleopard' in dirs_to_skip)
9798
98  def test_version(self):
99  port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
100  self.assertTrue(port.version())
 99 def _assert_version_string_for_release_string(self, port, expected_version_string, release_string):
 100 mac_ver = (release_string, ('', '', ''), 'i386')
 101 self.assertEquals(port._version_string_from_mac_ver_tuple(mac_ver), expected_version_string)
101102
102  def test_versions(self):
 103 def test_version_string_from_mac_ver_tuple(self):
103104 port = self.make_port()
104  if port:
105  self.assertTrue(port.name() in ('mac-leopard', 'mac-snowleopard', 'mac-future'))
106 
107  self.assert_name(None, '10.5.3', 'mac-leopard')
108  self.assert_name('mac', '10.5.3', 'mac-leopard')
109  self.assert_name('mac-leopard', '10.4.8', 'mac-leopard')
110  self.assert_name('mac-leopard', '10.5.3', 'mac-leopard')
111  self.assert_name('mac-leopard', '10.6.3', 'mac-leopard')
112 
113  self.assert_name(None, '10.6.3', 'mac-snowleopard')
114  self.assert_name('mac', '10.6.3', 'mac-snowleopard')
115  self.assert_name('mac-snowleopard', '10.4.3', 'mac-snowleopard')
116  self.assert_name('mac-snowleopard', '10.5.3', 'mac-snowleopard')
117  self.assert_name('mac-snowleopard', '10.6.3', 'mac-snowleopard')
118 
119  self.assert_name(None, '10.7', 'mac-future')
120  self.assert_name(None, '10.7.3', 'mac-future')
121  self.assert_name(None, '10.8', 'mac-future')
122  self.assert_name('mac', '10.7.3', 'mac-future')
123  self.assert_name('mac-future', '10.4.3', 'mac-future')
124  self.assert_name('mac-future', '10.5.3', 'mac-future')
125  self.assert_name('mac-future', '10.6.3', 'mac-future')
126  self.assert_name('mac-future', '10.7.3', 'mac-future')
127 
128  self.assertRaises(AssertionError, self.assert_name, None, '10.3.1', 'should-raise-assertion-so-this-value-does-not-matter')
 105 self._assert_version_string_for_release_string(port, 'leopard', '10.5.3')
 106 self._assert_version_string_for_release_string(port, 'snowleopard', '10.6.3')
 107 self._assert_version_string_for_release_string(port, None, '10.7.3')
 108 self._assert_version_string_for_release_string(port, None, '10.4.3')
129109
130110 def _assert_search_path(self, search_paths, version, use_webkit2=False):
131  # FIXME: Port constructors should not "parse" the port name, but
132  # rather be passed components (directly or via setters). Once
133  # we fix that, this method will need a re-write.
134  port = MacPort('mac-%s' % version, options=MockOptions(webkit_test_runner=use_webkit2), filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
 111 port = MacPort(os_version_string=version, options=MockOptions(webkit_test_runner=use_webkit2), filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive())
135112 absolute_search_paths = map(port._webkit_baseline_path, search_paths)
136113 self.assertEquals(port.baseline_search_path(), absolute_search_paths)
137114
138115 def test_baseline_search_path(self):
139  # FIXME: Is this really right? Should mac-leopard fallback to mac-snowleopard?
140116 self._assert_search_path(['mac-leopard', 'mac-snowleopard', 'mac'], 'leopard')
141117 self._assert_search_path(['mac-snowleopard', 'mac'], 'snowleopard')
142118
 119 # Note that wk2 is never used for results, only for Skipped files. This matches ORWT.
143120 self._assert_search_path(['mac-wk2', 'mac-leopard', 'mac-snowleopard', 'mac'], 'leopard', use_webkit2=True)
144121 self._assert_search_path(['mac-wk2', 'mac-snowleopard', 'mac'], 'snowleopard', use_webkit2=True)
145122

Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py

@@_log = logging.getLogger(__name__)
4949
5050
5151class MockDRTPort(object):
52  """MockPort implementation of the Port interface."""
 52 port_name = 'mock'
5353
5454 def __init__(self, **kwargs):
5555 prefix = 'mock-'

Tools/Scripts/webkitpy/layout_tests/port/qt.py

2626# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
29 """QtWebKit implementation of the Port interface."""
30 
3129import logging
3230import sys
3331

@@_log = logging.getLogger(__name__)
4139
4240class QtPort(WebKitPort):
4341 port_name = "qt"
 42 SUPPORTED_OPERATING_SYSTEMS = frozenset(['linux', 'win', 'mac'])
4443
4544 def _port_flag_for_scripts(self):
4645 return "--qt"

@@class QtPort(WebKitPort):
5756 # sys_platform exists only for unit testing.
5857 def __init__(self, sys_platform=None, **kwargs):
5958 WebKitPort.__init__(self, **kwargs)
 59 # FIXME: This can move into factory.py once we standardize operating system names across all ports.
6060 self._operating_system = self._operating_system_for_platform(sys_platform or sys.platform)
6161
6262 # FIXME: This will allow WebKitPort.baseline_search_path and WebKitPort._skipped_file_search_paths
6363 # to do the right thing, but doesn't include support for qt-4.8 or qt-arm (seen in LayoutTests/platform) yet.
64  name_components = [self.port_name]
65  if self._operating_system:
66  name_components.append(self._operating_system)
67  self._name = "-".join(name_components)
 64 self._name = self.cannonical_name()
6865
6966 def _build_driver(self):
7067 # The Qt port builds DRT as part of the main build step

Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py

@@class QtPortTest(port_testcase.PortTestCase):
4040 return QtPort
4141
4242 def _assert_search_path(self, search_paths, sys_platform, use_webkit2=False):
43  # FIXME: Port constructors should not "parse" the port name, but
44  # rather be passed components (directly or via setters). Once
45  # we fix that, this method will need a re-write.
4643 port = QtPort(sys_platform=sys_platform,
4744 options=MockOptions(webkit_test_runner=use_webkit2),
4845 filesystem=MockFileSystem(),

Tools/Scripts/webkitpy/layout_tests/port/test.py

@@WONTFIX SKIP : failures/expected/exception.html = CRASH
247247
248248
249249class TestPort(Port):
250  """Test implementation of the Port interface."""
251250 ALL_BASELINE_VARIANTS = (
252251 'test-mac-snowleopard', 'test-mac-leopard',
253252 'test-win-win7', 'test-win-vista', 'test-win-xp',
254253 'test-linux-x86_64',
255254 )
256255
 256 port_name = 'test'
 257
257258 def __init__(self, port_name=None, user=None, filesystem=None, **kwargs):
258259 if not port_name or port_name == 'test':
259260 port_name = 'test-mac-leopard'

Tools/Scripts/webkitpy/layout_tests/port/webkit.py

@@_log = logging.getLogger(__name__)
4949
5050
5151class WebKitPort(Port):
52  def __init__(self, **kwargs):
53  Port.__init__(self, **kwargs)
 52
 53 SUPPORTED_OPERATING_SYSTEMS = frozenset()
 54 SUPPORTED_OS_VERSIONS = frozenset()
 55
 56 def __init__(self, port_name=None, **kwargs):
 57 assert not port_name or port_name == self.port_name, "The port_name argument is deprecated for the WebKit ports. Please use port.factory.get() if you require port_name parsing."
 58 Port.__init__(self, port_name=port_name, **kwargs)
5459
5560 # FIXME: Disable pixel tests until they are run by default on build.webkit.org.
5661 self.set_option_default("pixel_tests", False)

@@class WebKitPort(Port):
313318 if self.get_option('webkit_test_runner'):
314319 # Because nearly all of the skipped tests for WebKit 2 are due to cross-platform
315320 # issues, all wk2 ports share a skipped list under platform/wk2.
 321 # However 'wk2' is not used to store any results (yet) thus does not appear in any baseline_search_path.
316322 search_paths.update([self._wk2_port_name(), "wk2"])
317323 return search_paths
318324

Tools/Scripts/webkitpy/layout_tests/port/win.py

2929"""WebKit Win implementation of the Port interface."""
3030
3131import logging
 32import sys
3233
3334from webkitpy.layout_tests.port.webkit import WebKitPort
3435

@@_log = logging.getLogger(__name__)
3940class WinPort(WebKitPort):
4041 port_name = "win"
4142
42  FALLBACK_PATHS = {
43  'win7': [
44  "win",
45  "mac-snowleopard",
46  "mac",
47  ],
48  }
 43 # This is a list of all supported OS-VERSION pairs for the AppleWin port
 44 # and the order of fallback between them. Matches ORWT.
 45 VERSION_FALLBACK_ORDER = ("win-xp", "win-vista", "win-7sp0", "win")
4946
50  def __init__(self, **kwargs):
 47 # This is designed to match old-run-webkit-tests behavior.
 48 def _version_string_from_windows_version_tuple(self, windows_version_tuple):
 49 if windows_version_tuple[:3] == (6, 1, 7600):
 50 return '7sp0'
 51 if windows_version_tuple[:2] == (6, 0):
 52 return 'vista'
 53 if windows_version_tuple[:2] == (5, 1):
 54 return 'xp'
 55 return None
 56
 57 def _detect_version(self):
 58 if not hasattr(sys, 'getwindowsversion'):
 59 return None
 60 version_tuple = tuple(sys.getwindowsversion()[:2])
 61 return self._version_string_from_windows_version_tuple(version_tuple)
 62
 63 def __init__(self, os_version_string=None, **kwargs):
5164 WebKitPort.__init__(self, **kwargs)
52  self._version = 'win7'
 65 self._version = os_version_string or self._detect_version()
5366 self._operating_system = 'win'
5467
5568 def baseline_search_path(self):
56  # Based on code from old-run-webkit-tests expectedDirectoryForTest()
57  # FIXME: This does not work for WebKit2.
58  return map(self._webkit_baseline_path, self.FALLBACK_PATHS[self._version])
 69 try:
 70 fallback_index = self.VERSION_FALLBACK_ORDER.index(self.cannonical_name())
 71 fallback_names = list(self.VERSION_FALLBACK_ORDER[fallback_index:])
 72 except ValueError:
 73 # Unknown versions just fall back to the base port results.
 74 fallback_names = [self.port_name]
 75 # FIXME: The AppleWin port falls back to AppleMac for some results. Eventually we'll have a shared 'apple' port.
 76 if self.get_option('webkit_test_runner'):
 77 fallback_names.insert(0, 'win-wk2')
 78 fallback_names.append('mac-wk2')
 79 # Note we do not add 'wk2' here, even though it's included in _skipped_search_paths().
 80 # FIXME: Perhaps we should get this list from MacPort?
 81 fallback_names.extend(['mac-snowleopard', 'mac'])
 82 return map(self._webkit_baseline_path, fallback_names)
5983
6084 # FIXME: webkitperl/httpd.pm installs /usr/lib/apache/libphp4.dll on cycwin automatically
6185 # as part of running old-run-webkit-tests. That's bad design, but we may need some similar hack.

Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py

 1# Copyright (C) 2010 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 StringIO
 30import sys
 31import unittest
 32
 33from webkitpy.layout_tests.port.win import WinPort
 34from webkitpy.layout_tests.port import port_testcase
 35from webkitpy.common.system.filesystem_mock import MockFileSystem
 36from webkitpy.common.system.outputcapture import OutputCapture
 37from webkitpy.tool.mocktool import MockOptions, MockUser, MockExecutive
 38
 39
 40class WinTest(port_testcase.PortTestCase):
 41 def port_maker(self, platform):
 42 return WinPort
 43
 44 def _assert_search_path(self, expected_search_paths, version, use_webkit2=False):
 45 port = WinPort(os_version_string=version,
 46 options=MockOptions(webkit_test_runner=use_webkit2),
 47 filesystem=MockFileSystem(),
 48 user=MockUser(),
 49 executive=MockExecutive())
 50 absolute_search_paths = map(port._webkit_baseline_path, expected_search_paths)
 51 self.assertEquals(port.baseline_search_path(), absolute_search_paths)
 52
 53 def test_baseline_search_path(self):
 54 self._assert_search_path(['win-xp', 'win-vista', 'win-7sp0', 'win', 'mac-snowleopard', 'mac'], 'xp')
 55 self._assert_search_path(['win-vista', 'win-7sp0', 'win', 'mac-snowleopard', 'mac'], 'vista')
 56 self._assert_search_path(['win-7sp0', 'win', 'mac-snowleopard', 'mac'], '7sp0')
 57 self._assert_search_path(['win', 'mac-snowleopard', 'mac'], 'bogus')
 58
 59 self._assert_search_path(['win-wk2', 'win-xp', 'win-vista', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'xp', use_webkit2=True)
 60 self._assert_search_path(['win-wk2', 'win-vista', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'vista', use_webkit2=True)
 61 self._assert_search_path(['win-wk2', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], '7sp0', use_webkit2=True)
 62 self._assert_search_path(['win-wk2', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'bogus', use_webkit2=True)

Tools/Scripts/webkitpy/tool/commands/rebaseline.py

@@class BuilderToPort(object):
8080 def port_for_builder(self, builder_name):
8181 port_name = self._port_name_for_builder_name(builder_name)
8282 assert(port_name) # Need to update _builder_name_to_port_name
 83 # FIXME: This should pass a FileSystem, User and Executive to the factory.
8384 port = factory.get(port_name)
8485 assert(port) # Need to update _builder_name_to_port_name
8586 return port