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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107151
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-08 Adam Barth <abarth@webkit.org>
+
+ 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 <gns@gnome.org>
Unreviewed typo fix that makes docs build again for the gtk2-based
"""
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
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:
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
-
- 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)
-
- # 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()
+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()
+
+ 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')
+
+ # 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):
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
# This test sometimes fails on Windows. See <http://webkit.org/b/55087>.
if sys.platform in ('cygwin', 'win32'):
return
-
- if multiprocessing:
- self.assertTrue(make_broker(self, 'processes') is not None)
- else:
- self.assertRaises(ValueError, make_broker, self, 'processes')
+ self.assertTrue(make_broker(self, 'processes') is not None)
def test_get__unknown(self):
self.assertRaises(ValueError, make_broker, self, 'unknown')
# 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):
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
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):
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."""
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'
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
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()
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