2011-02-03 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 00:15:18 +0000 (00:15 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 00:15:18 +0000 (00:15 +0000)
        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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/port/base.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py

index 5afe6db12fa5d4cd8e20603ddd0ba9cd6e053d8c..92d01827e1125af7c430873452632e65f71d6dba 100644 (file)
@@ -1,3 +1,23 @@
+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.
index d2c3370d461295c4ad5e5d29fe729b1b3a74c805..ad1cd7afd511a8c607900f891800cea220ce2311 100644 (file)
@@ -507,8 +507,7 @@ class Port(object):
     def abspath_for_test(self, test_name):
         """Returns the full path to the file for a given test name. This is the
         inverse of relative_test_filename()."""
-        # FIXME: Is this handling windows-style abspaths correctly?
-        return self._filesystem.join(self.layout_tests_dir(), test_name)
+        return self._filesystem.normpath(self._filesystem.join(self.layout_tests_dir(), test_name))
 
     def results_directory(self):
         """Absolute path to the place to store the test results."""
index 28e268269d9bf8c430671e6573f1376ac0afa4b3..9680f7055e06a854d24b837f66d5e3db49defc14 100644 (file)
@@ -32,48 +32,43 @@ import chromium_win
 
 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):
@@ -98,10 +93,9 @@ def _tests(port, paths):
 
 
 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.
@@ -123,10 +117,9 @@ class ChromiumGpuLinuxPort(chromium_linux.ChromiumLinuxPort):
 
 
 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']) +
@@ -147,10 +140,9 @@ class ChromiumGpuMacPort(chromium_mac.ChromiumMacPort):
 
 
 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']) +
index d1f1a9ab8275a9c79f74ed3790272c542d5afe54..f7c56ebf8b331d1240799cc2d318ae638360ea08 100644 (file)
@@ -40,20 +40,34 @@ class ChromiumGpuTest(unittest.TestCase):
     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()