Title: [107151] trunk/Tools
Revision
107151
Author
[email protected]
Date
2012-02-08 16:27:36 -0800 (Wed, 08 Feb 2012)

Log Message

webkitpy should reply upon the multiprocessing package existing
https://bugs.webkit.org/show_bug.cgi?id=78176

Reviewed by Eric Seidel.

Now that we don't support Python 2.5, this import can't fail.

* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
(get):
(_Process):
(_Process.__init__):
(_Process.run):
* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
(FunctionTests.test_get__processes):
(MultiProcessBrokerTests.setUp):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.__init__):
(Port.default_worker_model):
* Scripts/webkitpy/layout_tests/port/chromium_mac.py:
(ChromiumMacPort.check_build):
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
(PortTestCase.test_default_worker_model):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (107150 => 107151)


--- trunk/Tools/ChangeLog	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/ChangeLog	2012-02-09 00:27:36 UTC (rev 107151)
@@ -1,3 +1,29 @@
+2012-02-08  Adam Barth  <[email protected]>
+
+        webkitpy should reply upon the multiprocessing package existing
+        https://bugs.webkit.org/show_bug.cgi?id=78176
+
+        Reviewed by Eric Seidel.
+
+        Now that we don't support Python 2.5, this import can't fail.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
+        (get):
+        (_Process):
+        (_Process.__init__):
+        (_Process.run):
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
+        (FunctionTests.test_get__processes):
+        (MultiProcessBrokerTests.setUp):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.__init__):
+        (Port.default_worker_model):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+        (ChromiumMacPort.check_build):
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        (PortTestCase.test_default_worker_model):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+
 2012-02-08  Gustavo Noronha Silva  <[email protected]>
 
         Unreviewed typo fix that makes docs build again for the gtk2-based

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -42,17 +42,11 @@
 """
 
 import logging
+import multiprocessing
 import optparse
 import Queue
 import sys
 
-
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 # These are needed when workers are launched in new child processes.
 from webkitpy.common.host import Host
 from webkitpy.common.host_mock import MockHost
@@ -99,7 +93,7 @@
     if worker_model == 'inline':
         queue_class = Queue.Queue
         manager_class = _InlineManager
-    elif worker_model == 'processes' and multiprocessing:
+    elif worker_model == 'processes':
         queue_class = multiprocessing.Queue
         manager_class = _MultiProcessManager
     else:
@@ -245,42 +239,40 @@
         raise exc_info[0], exc_info[1], exc_info[2]
 
 
-if multiprocessing:
+class _Process(multiprocessing.Process):
+    def __init__(self, worker_connection, platform_name, options, client):
+        multiprocessing.Process.__init__(self)
+        self._worker_connection = worker_connection
+        self._platform_name = platform_name
+        self._options = options
+        self._client = client
 
-    class _Process(multiprocessing.Process):
-        def __init__(self, worker_connection, platform_name, options, client):
-            multiprocessing.Process.__init__(self)
-            self._worker_connection = worker_connection
-            self._platform_name = platform_name
-            self._options = options
-            self._client = client
+    def run(self):
+        # We need to create a new Host object here because this is
+        # running in a new process and we can't require the parent's
+        # Host to be pickleable and passed to the child.
+        if self._platform_name.startswith('test'):
+            host = MockHost()
+        else:
+            host = Host()
+        host._initialize_scm()
 
-        def run(self):
-            # We need to create a new Host object here because this is
-            # running in a new process and we can't require the parent's
-            # Host to be pickleable and passed to the child.
-            if self._platform_name.startswith('test'):
-                host = MockHost()
-            else:
-                host = Host()
-            host._initialize_scm()
+        options = self._options
+        port_obj = host.port_factory.get(self._platform_name, options)
 
-            options = self._options
-            port_obj = host.port_factory.get(self._platform_name, options)
+        # The unix multiprocessing implementation clones the
+        # log handler configuration into the child processes,
+        # but the win implementation doesn't.
+        configure_logging = (sys.platform == 'win32')
 
-            # The unix multiprocessing implementation clones the
-            # log handler configuration into the child processes,
-            # but the win implementation doesn't.
-            configure_logging = (sys.platform == 'win32')
+        # FIXME: this won't work if the calling process is logging
+        # somewhere other than sys.stderr and sys.stdout, but I'm not sure
+        # if this will be an issue in practice.
+        printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging)
+        self._client.run(port_obj)
+        printer.cleanup()
 
-            # FIXME: this won't work if the calling process is logging
-            # somewhere other than sys.stderr and sys.stdout, but I'm not sure
-            # if this will be an issue in practice.
-            printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging)
-            self._client.run(port_obj)
-            printer.cleanup()
 
-
 class _MultiProcessWorkerConnection(_WorkerConnection):
     def __init__(self, broker, platform_name, worker_class, worker_number, results_directory, options):
         _WorkerConnection.__init__(self, broker, worker_class, worker_number, results_directory, options)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -31,15 +31,8 @@
 import sys
 import unittest
 
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
-
 from webkitpy.common.system import outputcapture
 from webkitpy.common.host_mock import MockHost
-
 from webkitpy.layout_tests import port
 from webkitpy.layout_tests.controllers import manager_worker_broker
 from webkitpy.layout_tests.controllers import message_broker
@@ -127,12 +120,8 @@
         # This test sometimes fails on Windows. See <http://webkit.org/b/55087>.
         if sys.platform in ('cygwin', 'win32'):
             return
+        self.assertTrue(make_broker(self, 'processes') is not None)
 
-        if multiprocessing:
-            self.assertTrue(make_broker(self, 'processes') is not None)
-        else:
-            self.assertRaises(ValueError, make_broker, self, 'processes')
-
     def test_get__unknown(self):
         self.assertRaises(ValueError, make_broker, self, 'unknown')
 
@@ -205,17 +194,14 @@
 
 
 # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54520.
-if multiprocessing and sys.platform not in ('cygwin', 'win32'):
+if sys.platform not in ('cygwin', 'win32'):
 
     class MultiProcessBrokerTests(_TestsMixin, unittest.TestCase):
         def setUp(self):
             _TestsMixin.setUp(self)
             self._worker_model = 'processes'
 
-        def queue(self):
-            return multiprocessing.Queue()
 
-
 class FunctionsTest(unittest.TestCase):
     def test_runtime_options(self):
         option_list = manager_worker_broker.runtime_options()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -38,14 +38,6 @@
 
 from webkitpy.common.memoized import memoized
 from webkitpy.common.system import path
-
-
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 from webkitpy.common import find_files
 from webkitpy.common.system import logutils
 from webkitpy.common.system.executive import ScriptError
@@ -148,7 +140,6 @@
             self.set_option_default('configuration', self.default_configuration())
         self._test_configuration = None
         self._reftest_list = {}
-        self._multiprocessing_is_available = (multiprocessing is not None)
         self._results_directory = None
 
     def wdiff_available(self):
@@ -176,9 +167,7 @@
         return cpu_count
 
     def default_worker_model(self):
-        if self._multiprocessing_is_available:
-            return 'processes'
-        return 'inline'
+        return 'processes'
 
     def baseline_path(self):
         """Return the absolute path to the directory to store new baselines in for this port."""

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -102,13 +102,6 @@
 
         return result
 
-    def default_child_processes(self):
-        if not self._multiprocessing_is_available:
-            # Running multiple threads in Mac Python is unstable (See
-            # https://bugs.webkit.org/show_bug.cgi?id=38553 for more info).
-            return 1
-        return chromium.ChromiumPort.default_child_processes(self)
-
     def operating_system(self):
         return 'mac'
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -30,19 +30,11 @@
 
 import errno
 import socket
-
 import sys
 import time
 import unittest
 
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 from webkitpy.layout_tests.servers import http_server_base
-
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive
@@ -68,10 +60,7 @@
 
     def test_default_worker_model(self):
         port = self.make_port()
-        if multiprocessing:
-            self.assertEqual(port.default_worker_model(), 'processes')
-        else:
-            self.assertEqual(port.default_worker_model(), 'inline')
+        self.assertEqual(port.default_worker_model(), 'processes')
 
     def test_driver_cmd_line(self):
         port = self.make_port()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (107150 => 107151)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-02-09 00:25:00 UTC (rev 107150)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-02-09 00:27:36 UTC (rev 107151)
@@ -43,14 +43,9 @@
 
 from webkitpy.common.system import path
 
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 # FIXME: remove this when we fix test-webkitpy to work properly on cygwin
 # (bug 63846).
-SHOULD_TEST_PROCESSES = multiprocessing and sys.platform not in ('cygwin', 'win32')
+SHOULD_TEST_PROCESSES = sys.platform not in ('cygwin', 'win32')
 
 from webkitpy.common import array_stream
 from webkitpy.common.system import outputcapture
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to