WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
fix 'chromium-gpu' as a port name, add tests
bug-75590-20120105124307.patch (text/plain), 22.25 KB, created by
Dirk Pranke
on 2012-01-05 12:43:08 PST
(
hide
)
Description:
fix 'chromium-gpu' as a port name, add tests
Filename:
MIME Type:
Creator:
Dirk Pranke
Created:
2012-01-05 12:43:08 PST
Size:
22.25 KB
patch
obsolete
>Subversion Revision: 104089 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 92c20e7276be6201e7d451ee302603cb3468b8ed..9f1a32fbb518787387b9e679d80d08deebbcd85f 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,37 @@ >+2012-01-04 Dirk Pranke <dpranke@chromium.org> >+ >+ webkitpy: clean up port factory methods >+ https://bugs.webkit.org/show_bug.cgi?id=75590 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This change consolidates much of the "factory method" logic >+ of determining which port objects to create for a given set >+ of configurations by merging the separate factory methods in >+ chromium_gpu and google_chrome into PortFactory so that at least >+ all of the logic is in one place. >+ >+ * Scripts/webkitpy/layout_tests/port/chromium_gpu.py: >+ * Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py: >+ * Scripts/webkitpy/layout_tests/port/factory.py: >+ (_port_name_from_arguments_and_options): >+ (get): >+ * Scripts/webkitpy/layout_tests/port/factory_unittest.py: >+ (test_google_chrome): >+ * Scripts/webkitpy/layout_tests/port/google_chrome.py: >+ (GoogleChromeLinux32Port): >+ (GoogleChromeLinux32Port.baseline_search_path): >+ (test_expectations_overrides): >+ (architecture): >+ (GoogleChromeLinux64Port): >+ (GoogleChromeLinux64Port.baseline_search_path): >+ (GoogleChromeMacPort): >+ (GoogleChromeMacPort.baseline_search_path): >+ (GoogleChromeWinPort): >+ (GoogleChromeWinPort.baseline_search_path): >+ * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py: >+ (_verify_baseline_path): >+ > 2012-01-04 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> > > Adding myself to committers list. >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py >index 603eafc72e02bb6b789e6b4e195fee9ba114c286..3e9ded686f437d02c01e2322b57b1e2a4e6ce254 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py >@@ -31,33 +31,7 @@ import chromium_mac > import chromium_win > > >-def get(host, 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.""" >- platform = platform or sys.platform >- if port_name == 'chromium-gpu': >- if platform in ('cygwin', 'win32'): >- port_name = 'chromium-gpu-win' >- elif platform.startswith('linux'): >- port_name = 'chromium-gpu-linux' >- elif platform == 'darwin': >- port_name = 'chromium-gpu-mac' >- else: >- raise NotImplementedError('unsupported platform: %s' % platform) >- >- if port_name.startswith('chromium-gpu-linux'): >- return ChromiumGpuLinuxPort(host, port_name=port_name, **kwargs) >- if port_name.startswith('chromium-gpu-cg-mac'): >- return ChromiumGpuCgMacPort(host, port_name=port_name, **kwargs) >- if port_name.startswith('chromium-gpu-mac'): >- return ChromiumGpuMacPort(host, port_name=port_name, **kwargs) >- if port_name.startswith('chromium-gpu-win'): >- return ChromiumGpuWinPort(host, port_name=port_name, **kwargs) >- raise NotImplementedError('unsupported port: %s' % port_name) >- >- >-# FIXME: These should really be a mixin class. >+# FIXME: This whole file needs to go away and we need to eliminate the GPU configuration. > > def _set_gpu_options(port, graphics_type='gpu'): > port._graphics_type = graphics_type >@@ -90,7 +64,7 @@ def _default_tests_paths(port): > paths += ['fast/canvas', 'canvas/philip'] > > if not paths: >- # FIXME: This is a hack until we can turn of the webkit_gpu >+ # FIXME: This is a hack until we can turn off the webkit_gpu > # tests on the bots. If paths is empty, port.tests() > # finds *everything*. However, we have to return something, > # or NRWT thinks there's something wrong. So, we return a single >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py >index f674c436d214786ae7687e9ee027c1a58c36214e..965fb586d8e543a57e041f887520c482b4a8f8ad 100755 >--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py >@@ -27,12 +27,12 @@ > import sys > import unittest > >-import chromium_gpu >- >-from webkitpy.tool.mocktool import MockOptions > from webkitpy.common.host_mock import MockHost >-from webkitpy.layout_tests.port import port_testcase > from webkitpy.common.system.filesystem_mock import MockFileSystem >+from webkitpy.layout_tests.port import chromium_gpu >+from webkitpy.layout_tests.port import port_testcase >+from webkitpy.layout_tests.port.factory import PortFactory >+from webkitpy.tool.mocktool import MockOptions > > > class ChromiumGpuTest(unittest.TestCase): >@@ -62,9 +62,9 @@ class ChromiumGpuTest(unittest.TestCase): > builder_name='foo', > child_processes=None) > if input_name and platform: >- port = chromium_gpu.get(host, platform=platform, port_name=input_name, options=mock_options) >+ port = PortFactory(host).get(host, platform=platform, port_name=input_name, options=mock_options) > else: >- port = chromium_gpu.get(host, port_name=port_name, options=mock_options) >+ port = PortFactory(host).get(host, port_name=port_name, options=mock_options) > self.assertTrue(port._options.accelerated_2d_canvas) > self.assertTrue(port._options.accelerated_video) > self.assertTrue(port._options.experimental_fully_parallel) >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/factory.py b/Tools/Scripts/webkitpy/layout_tests/port/factory.py >index 7672de44c678b27f6a6f3a984f260537885e538d..f87a447b0c4715a5a3bb7f98ba0c3d921b079c3b 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/factory.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/factory.py >@@ -45,31 +45,38 @@ class PortFactory(object): > def __init__(self, host): > self._host = host > >- def _port_name_from_arguments_and_options(self, **kwargs): >- port_to_use = kwargs.get('port_name', None) >- options = kwargs.get('options', None) >- if port_to_use is None: >- if sys.platform == 'win32' or sys.platform == 'cygwin': >- if options and hasattr(options, 'chromium') and options.chromium: >- port_to_use = 'chromium-win' >- else: >- port_to_use = 'win' >- elif sys.platform.startswith('linux'): >- port_to_use = 'chromium-linux' >- elif sys.platform == 'darwin': >- if options and hasattr(options, 'chromium') and options.chromium: >- port_to_use = 'chromium-cg-mac' >- # FIXME: Add a way to select the chromium-mac port. >- else: >- port_to_use = 'mac' >- >- if port_to_use is None: >- raise NotImplementedError('unknown port; sys.platform = "%s"' % sys.platform) >- return port_to_use >- >- def _get_kwargs(self, **kwargs): >- port_to_use = self._port_name_from_arguments_and_options(**kwargs) >+ def _port_name_from_arguments_and_options(self, port_name, options, platform): >+ if port_name == 'chromium-gpu': >+ if platform in ('cygwin', 'win32'): >+ return 'chromium-gpu-win' >+ if platform.startswith('linux'): >+ return 'chromium-gpu-linux' >+ if platform == 'darwin': >+ return 'chromium-gpu-mac' > >+ if port_name: >+ return port_name >+ >+ if platform in ('win32', 'cygwin'): >+ if options and hasattr(options, 'chromium') and options.chromium: >+ return 'chromium-win' >+ return 'win' >+ if platform.startswith('linux'): >+ return 'chromium-linux' >+ if platform == 'darwin': >+ if options and hasattr(options, 'chromium') and options.chromium: >+ return 'chromium-cg-mac' >+ # FIXME: Add a way to select the chromium-mac port. >+ return 'mac' >+ >+ raise NotImplementedError('unknown port; platform = "%s"' % platform) >+ >+ def get(self, port_name=None, options=None, platform=None, **kwargs): >+ """Returns an object implementing the Port interface. If >+ port_name is None, this routine attempts to guess at the most >+ appropriate port on this platform.""" >+ platform = platform or sys.platform >+ port_to_use = self._port_name_from_arguments_and_options(port_name, options, platform) > if port_to_use.startswith('test'): > import test > maker = test.TestPort >@@ -91,11 +98,25 @@ class PortFactory(object): > elif port_to_use.startswith('qt'): > import qt > maker = qt.QtPort >- elif port_to_use.startswith('chromium-gpu'): >+ elif port_to_use.startswith('chromium-gpu-linux'): > import chromium_gpu >- maker = chromium_gpu.get >+ port_name = port_to_use >+ maker = chromium_gpu.ChromiumGpuLinuxPort >+ elif port_to_use.startswith('chromium-gpu-cg-mac'): >+ import chromium_gpu >+ port_name = port_to_use >+ maker = chromium_gpu.ChromiumGpuCgMacPort >+ elif port_to_use.startswith('chromium-gpu-mac'): >+ import chromium_gpu >+ port_name = port_to_use >+ maker = chromium_gpu.ChromiumGpuMacPort >+ elif port_to_use.startswith('chromium-gpu-win'): >+ import chromium_gpu >+ port_name = port_to_use >+ maker = chromium_gpu.ChromiumGpuWinPort > elif port_to_use.startswith('chromium-mac') or port_to_use.startswith('chromium-cg-mac'): > import chromium_mac >+ port_name = port_to_use > maker = chromium_mac.ChromiumMacPort > elif port_to_use.startswith('chromium-linux'): > import chromium_linux >@@ -103,16 +124,27 @@ class PortFactory(object): > elif port_to_use.startswith('chromium-win'): > import chromium_win > maker = chromium_win.ChromiumWinPort >- elif port_to_use.startswith('google-chrome'): >+ elif port_to_use == 'google-chrome-linux32': >+ import google_chrome >+ port_name = 'chromium-linux-x86' >+ maker = google_chrome.GoogleChromeLinux32Port >+ elif port_to_use == 'google-chrome-linux64': > import google_chrome >- maker = google_chrome.GetGoogleChromePort >+ port_name = 'chromium-linux-x86_64' >+ maker = google_chrome.GoogleChromeLinux64Port >+ elif port_to_use.startswith('google-chrome-win'): >+ import google_chrome >+ maker = google_chrome.GoogleChromeWinPort >+ elif port_to_use.startswith('google-chrome-mac'): >+ import google_chrome >+ maker = google_chrome.GoogleChromeMacPort > elif port_to_use.startswith('efl'): > import efl > maker = efl.EflPort > else: > raise NotImplementedError('unsupported port: %s' % port_to_use) > >- return maker(self._host, **kwargs) >+ return maker(self._host, port_name=port_name, options=options, **kwargs) > > def all_port_names(self): > """Return a list of all valid, fully-specified, "real" port names. >@@ -123,17 +155,6 @@ class PortFactory(object): > # FIXME: There's probably a better way to generate this list ... > return builders.all_port_names() > >- def get(self, port_name=None, options=None, **kwargs): >- """Returns an object implementing the Port interface. If >- port_name is None, this routine attempts to guess at the most >- appropriate port on this platform.""" >- # Wrapped for backwards-compatibility >- if port_name: >- kwargs['port_name'] = port_name >- if options: >- kwargs['options'] = options >- return self._get_kwargs(**kwargs) >- > def get_from_builder_name(self, builder_name): > port_name = builders.port_name_for_builder_name(builder_name) > assert(port_name) # Need to update port_name_for_builder_name >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py >index 1f9c236c6b326058f8b9106fda03bf14ebb22d6c..16874e0c6a6cf911b3738be61d6528e69d4c671a 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py >@@ -64,7 +64,7 @@ class FactoryTest(unittest.TestCase): > def tearDown(self): > sys.platform = self.real_sys_platform > >- def assert_port(self, port_name, expected_port, port_obj=None): >+ def assert_port(self, port_name, expected_port, port_obj=None, platform=None): > """Helper assert for port_name. > > Args: >@@ -72,7 +72,7 @@ class FactoryTest(unittest.TestCase): > expected_port: class of expected port object. > port_obj: optional port object > """ >- port_obj = port_obj or self.factory.get(port_name=port_name) >+ port_obj = port_obj or self.factory.get(port_name=port_name, platform=platform) > self.assertTrue(isinstance(port_obj, expected_port)) > > def assert_platform_port(self, platform, options, expected_port): >@@ -104,12 +104,10 @@ class FactoryTest(unittest.TestCase): > self.assert_platform_port("cygwin", self.webkit_options, win.WinPort) > > def test_google_chrome(self): >- # The actual Chrome class names aren't available so we test that the >- # objects we get are at least subclasses of the Chromium versions. >- self.assert_port("google-chrome-linux32", chromium_linux.ChromiumLinuxPort) >- self.assert_port("google-chrome-linux64", chromium_linux.ChromiumLinuxPort) >- self.assert_port("google-chrome-win", chromium_win.ChromiumWinPort) >- self.assert_port("google-chrome-mac", chromium_mac.ChromiumMacPort) >+ self.assert_port("google-chrome-linux32", google_chrome.GoogleChromeLinux32Port) >+ self.assert_port("google-chrome-linux64", google_chrome.GoogleChromeLinux64Port) >+ self.assert_port("google-chrome-win", google_chrome.GoogleChromeWinPort) >+ self.assert_port("google-chrome-mac", google_chrome.GoogleChromeMacPort) > > def test_gtk(self): > self.assert_port("gtk", gtk.GtkPort) >@@ -117,6 +115,13 @@ class FactoryTest(unittest.TestCase): > def test_qt(self): > self.assert_port("qt", qt.QtPort) > >+ def test_chromium_gpu(self): >+ self.assert_port('chromium-gpu', chromium_gpu.ChromiumGpuMacPort, platform='darwin') >+ self.assert_port('chromium-gpu', chromium_gpu.ChromiumGpuWinPort, platform='win32') >+ self.assert_port('chromium-gpu', chromium_gpu.ChromiumGpuWinPort, platform='cygwin') >+ self.assert_port('chromium-gpu', chromium_gpu.ChromiumGpuLinuxPort, platform='linux2') >+ self.assert_port('chromium-gpu', chromium_gpu.ChromiumGpuLinuxPort, platform='linux3') >+ > def test_chromium_gpu_linux(self): > self.assert_port("chromium-gpu-linux", chromium_gpu.ChromiumGpuLinuxPort) > >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py >index a71cc6de6547776de3fc68108aa8a1493deea969..1d778312684f9a6261b52a5b31c31be467740ecf 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py >@@ -24,6 +24,10 @@ > # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > >+import chromium_linux >+import chromium_mac >+import chromium_win >+ > > def _test_expectations_overrides(port, super): > # The chrome ports use the regular overrides plus anything in the >@@ -42,70 +46,47 @@ def _test_expectations_overrides(port, super): > return chromium_overrides + port._filesystem.read_text_file(overrides_path) > > >-def GetGoogleChromePort(host, **kwargs): >- """Some tests have slightly different results when compiled as Google >- Chrome vs Chromium. In those cases, we prepend an additional directory to >- to the baseline paths.""" >- # FIXME: This whole routine is a tremendous hack that needs to be cleaned up. >- >- port_name = kwargs['port_name'] >- del kwargs['port_name'] >- if port_name == 'google-chrome-linux32': >- import chromium_linux >- >- class GoogleChromeLinux32Port(chromium_linux.ChromiumLinuxPort): >- def baseline_search_path(self): >- paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(self) >- paths.insert(0, self._webkit_baseline_path('google-chrome-linux32')) >- return paths >- >- def test_expectations_overrides(self): >- return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort) >+class GoogleChromeLinux32Port(chromium_linux.ChromiumLinuxPort): >+ def baseline_search_path(self): >+ paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(self) >+ paths.insert(0, self._webkit_baseline_path('google-chrome-linux32')) >+ return paths > >- def architecture(self): >- return 'x86' >+ def test_expectations_overrides(self): >+ return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort) > >- return GoogleChromeLinux32Port(host, port_name='chromium-linux-x86', **kwargs) >- elif port_name == 'google-chrome-linux64': >- import chromium_linux >+ def architecture(self): >+ return 'x86' > >- class GoogleChromeLinux64Port(chromium_linux.ChromiumLinuxPort): >- def baseline_search_path(self): >- paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(self) >- paths.insert(0, self._webkit_baseline_path('google-chrome-linux64')) >- return paths > >- def test_expectations_overrides(self): >- return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort) >+class GoogleChromeLinux64Port(chromium_linux.ChromiumLinuxPort): >+ def baseline_search_path(self): >+ paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(self) >+ paths.insert(0, self._webkit_baseline_path('google-chrome-linux64')) >+ return paths > >- def architecture(self): >- return 'x86_64' >+ def test_expectations_overrides(self): >+ return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort) > >- return GoogleChromeLinux64Port(host, port_name='chromium-linux-x86_64', **kwargs) >- elif port_name.startswith('google-chrome-mac'): >- import chromium_mac >+ def architecture(self): >+ return 'x86_64' > >- class GoogleChromeMacPort(chromium_mac.ChromiumMacPort): >- def baseline_search_path(self): >- paths = chromium_mac.ChromiumMacPort.baseline_search_path(self) >- paths.insert(0, self._webkit_baseline_path('google-chrome-mac')) >- return paths > >- def test_expectations_overrides(self): >- return _test_expectations_overrides(self, chromium_mac.ChromiumMacPort) >+class GoogleChromeMacPort(chromium_mac.ChromiumMacPort): >+ def baseline_search_path(self): >+ paths = chromium_mac.ChromiumMacPort.baseline_search_path(self) >+ paths.insert(0, self._webkit_baseline_path('google-chrome-mac')) >+ return paths > >- return GoogleChromeMacPort(host, **kwargs) >- elif port_name.startswith('google-chrome-win'): >- import chromium_win >+ def test_expectations_overrides(self): >+ return _test_expectations_overrides(self, chromium_mac.ChromiumMacPort) > >- class GoogleChromeWinPort(chromium_win.ChromiumWinPort): >- def baseline_search_path(self): >- paths = chromium_win.ChromiumWinPort.baseline_search_path(self) >- paths.insert(0, self._webkit_baseline_path('google-chrome-win')) >- return paths > >- def test_expectations_overrides(self): >- return _test_expectations_overrides(self, chromium_win.ChromiumWinPort) >+class GoogleChromeWinPort(chromium_win.ChromiumWinPort): >+ def baseline_search_path(self): >+ paths = chromium_win.ChromiumWinPort.baseline_search_path(self) >+ paths.insert(0, self._webkit_baseline_path('google-chrome-win')) >+ return paths > >- return GoogleChromeWinPort(host, **kwargs) >- raise NotImplementedError('unsupported port: %s' % port_name) >+ def test_expectations_overrides(self): >+ return _test_expectations_overrides(self, chromium_win.ChromiumWinPort) >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py >index 36e4ab6aa71737af98383d21b636bbfde77f8eb3..b2013e2a7be5415f2e2f19ffda4a944cdebd90ef 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py >@@ -27,7 +27,6 @@ > import unittest > > from webkitpy.common.host_mock import MockHost >-from webkitpy.layout_tests.port import google_chrome > > > class GetGoogleChromePortTest(unittest.TestCase): >@@ -42,7 +41,7 @@ class GetGoogleChromePortTest(unittest.TestCase): > self._verify_baseline_path('google-chrome-win', 'google-chrome-win-vista') > > def _verify_baseline_path(self, expected_path, port_name): >- port = google_chrome.GetGoogleChromePort(MockHost(), port_name=port_name) >+ port = MockHost().port_factory.get(port_name=port_name) > path = port.baseline_search_path()[0] > self.assertEqual(expected_path, port._filesystem.basename(path)) > >@@ -55,7 +54,7 @@ class GetGoogleChromePortTest(unittest.TestCase): > host = MockHost() > chromium_port = host.port_factory.get("chromium-cg-mac") > chromium_base = chromium_port.path_from_chromium_base() >- port = google_chrome.GetGoogleChromePort(host, port_name=port_name, options=None) >+ port = host.port_factory.get(port_name=port_name, options=None) > > expected_chromium_overrides = '// chromium overrides\n' > expected_chrome_overrides = '// chrome overrides\n'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 75590
:
121194
| 121313