+2011-02-03 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Mihai Parparita.
+
+ new-run-webkit-tests: Fix bug introduced in r77434 that was
+ causing us to run the canvas GPU tests on the Mac GPU port. This
+ bug revealed that we were not setting the port.name() field
+ properly in many cases, so I've cleaned up all of that code, and
+ removed a few comments about "version-specific" GPU ports that
+ don't exist and just confused things.
+
+ Testing also revealed that port.abspath_for_test() wasn't
+ normalizing paths on Windows properly, so I fixed that as well.
+
+ https://bugs.webkit.org/show_bug.cgi?id=53719
+
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_gpu.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py:
+
2011-02-03 Dirk Pranke <dpranke@chromium.org>
Reviewed by Mihai Parparita.
from webkitpy.layout_tests.port import test_files
-def get(**kwargs):
+
+def get(platform=None, port_name='chromium-gpu', **kwargs):
"""Some tests have slightly different results when run while using
hardware acceleration. In those cases, we prepend an additional directory
to the baseline paths."""
- port_name = kwargs.get('port_name', None)
+ platform = platform or sys.platform
if port_name == 'chromium-gpu':
- if sys.platform in ('cygwin', 'win32'):
+ if platform in ('cygwin', 'win32'):
port_name = 'chromium-gpu-win'
- elif sys.platform == 'linux2':
+ elif platform == 'linux2':
port_name = 'chromium-gpu-linux'
- elif sys.platform == 'darwin':
+ elif platform == 'darwin':
port_name = 'chromium-gpu-mac'
else:
- raise NotImplementedError('unsupported platform: %s' %
- sys.platform)
+ raise NotImplementedError('unsupported platform: %s' % platform)
- # FIXME: handle version-specific variants.
if port_name == 'chromium-gpu-linux':
- return ChromiumGpuLinuxPort(**kwargs)
-
- if port_name.startswith('chromium-gpu-mac'):
- return ChromiumGpuMacPort(**kwargs)
-
- if port_name.startswith('chromium-gpu-win'):
- return ChromiumGpuWinPort(**kwargs)
-
+ return ChromiumGpuLinuxPort(port_name=port_name, **kwargs)
+ if port_name == 'chromium-gpu-mac':
+ return ChromiumGpuMacPort(port_name=port_name, **kwargs)
+ if port_name == 'chromium-gpu-win':
+ return ChromiumGpuWinPort(port_name=port_name, **kwargs)
raise NotImplementedError('unsupported port: %s' % port_name)
# FIXME: These should really be a mixin class.
-def _set_gpu_options(options):
- if options:
- if options.accelerated_compositing is None:
- options.accelerated_compositing = True
- if options.accelerated_2d_canvas is None:
- options.accelerated_2d_canvas = True
+def _set_gpu_options(port):
+ if port.get_option('accelerated_compositing') is None:
+ port._options.accelerated_compositing = True
+ if port.get_option('accelerated_2d_canvas') is None:
+ port._options.accelerated_2d_canvas = True
- # FIXME: Remove this after http://codereview.chromium.org/5133001/ is enabled
- # on the bots.
- if options.builder_name is not None and not ' - GPU' in options.builder_name:
- options.builder_name = options.builder_name + ' - GPU'
+ # FIXME: Remove this after http://codereview.chromium.org/5133001/ is enabled
+ # on the bots.
+ if port.get_option('builder_name') is not None and not ' - GPU' in port._options.builder_name:
+ port._options.builder_name += ' - GPU'
def _gpu_overrides(port):
class ChromiumGpuLinuxPort(chromium_linux.ChromiumLinuxPort):
- def __init__(self, **kwargs):
- kwargs.setdefault('port_name', 'chromium-gpu-linux')
- _set_gpu_options(kwargs.get('options'))
- chromium_linux.ChromiumLinuxPort.__init__(self, **kwargs)
+ def __init__(self, port_name='chromium-gpu-linux', **kwargs):
+ chromium_linux.ChromiumLinuxPort.__init__(self, port_name=port_name, **kwargs)
+ _set_gpu_options(self)
def baseline_search_path(self):
# Mimic the Linux -> Win expectations fallback in the ordinary Chromium port.
class ChromiumGpuMacPort(chromium_mac.ChromiumMacPort):
- def __init__(self, **kwargs):
- kwargs.setdefault('port_name', 'chromium-gpu-mac')
- _set_gpu_options(kwargs.get('options'))
- chromium_mac.ChromiumMacPort.__init__(self, **kwargs)
+ def __init__(self, port_name='chromium-gpu-mac', **kwargs):
+ chromium_mac.ChromiumMacPort.__init__(self, port_name=port_name, **kwargs)
+ _set_gpu_options(self)
def baseline_search_path(self):
return (map(self._webkit_baseline_path, ['chromium-gpu-mac', 'chromium-gpu']) +
class ChromiumGpuWinPort(chromium_win.ChromiumWinPort):
- def __init__(self, **kwargs):
- kwargs.setdefault('port_name', 'chromium-gpu-win' + self.version())
- _set_gpu_options(kwargs.get('options'))
- chromium_win.ChromiumWinPort.__init__(self, **kwargs)
+ def __init__(self, port_name='chromium-gpu-win', **kwargs):
+ chromium_win.ChromiumWinPort.__init__(self, port_name=port_name, **kwargs)
+ _set_gpu_options(self)
def baseline_search_path(self):
return (map(self._webkit_baseline_path, ['chromium-gpu-win', 'chromium-gpu']) +
def test_get_chromium_gpu_win(self):
self.assertOverridesWorked('chromium-gpu-win')
- def assertOverridesWorked(self, port_name):
+ def test_get_chromium_gpu__on_linux(self):
+ self.assertOverridesWorked('chromium-gpu-linux', 'chromium-gpu', 'linux2')
+
+ def test_get_chromium_gpu__on_mac(self):
+ self.assertOverridesWorked('chromium-gpu-mac', 'chromium-gpu', 'darwin')
+
+ def test_get_chromium_gpu__on_win(self):
+ self.assertOverridesWorked('chromium-gpu-win', 'chromium-gpu', 'win32')
+ self.assertOverridesWorked('chromium-gpu-win', 'chromium-gpu', 'cygwin')
+
+ def assertOverridesWorked(self, port_name, input_name=None, platform=None):
# test that we got the right port
mock_options = mocktool.MockOptions(accelerated_compositing=None,
accelerated_2d_canvas=None,
builder_name='foo',
child_processes=None)
- port = chromium_gpu.get(port_name=port_name, options=mock_options)
+ if input_name and platform:
+ port = chromium_gpu.get(platform=platform, port_name=input_name,
+ options=mock_options)
+ else:
+ port = chromium_gpu.get(port_name=port_name, options=mock_options)
self.assertTrue(port._options.accelerated_compositing)
self.assertTrue(port._options.accelerated_2d_canvas)
self.assertEqual(port.default_child_processes(), 1)
self.assertEqual(port._options.builder_name, 'foo - GPU')
- # we use startswith() instead of Equal to gloss over platform versions.
- self.assertTrue(port.name().startswith(port_name))
+ # We don't support platform-specific versions of the GPU port yet.
+ self.assertEqual(port.name(), port_name)
# test that it has the right directories in front of the search path.
paths = port.baseline_search_path()