Changeset 107151 in webkit
- Timestamp:
- Feb 8, 2012 4:27:36 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r107150 r107151 1 2012-02-08 Adam Barth <abarth@webkit.org> 2 3 webkitpy should reply upon the multiprocessing package existing 4 https://bugs.webkit.org/show_bug.cgi?id=78176 5 6 Reviewed by Eric Seidel. 7 8 Now that we don't support Python 2.5, this import can't fail. 9 10 * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py: 11 (get): 12 (_Process): 13 (_Process.__init__): 14 (_Process.run): 15 * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py: 16 (FunctionTests.test_get__processes): 17 (MultiProcessBrokerTests.setUp): 18 * Scripts/webkitpy/layout_tests/port/base.py: 19 (Port.__init__): 20 (Port.default_worker_model): 21 * Scripts/webkitpy/layout_tests/port/chromium_mac.py: 22 (ChromiumMacPort.check_build): 23 * Scripts/webkitpy/layout_tests/port/port_testcase.py: 24 (PortTestCase.test_default_worker_model): 25 * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: 26 1 27 2012-02-08 Gustavo Noronha Silva <gns@gnome.org> 2 28 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py
r103289 r107151 43 43 44 44 import logging 45 import multiprocessing 45 46 import optparse 46 47 import Queue 47 48 import sys 48 49 50 # Handle Python < 2.6 where multiprocessing isn't available.51 try:52 import multiprocessing53 except ImportError:54 multiprocessing = None55 49 56 50 # These are needed when workers are launched in new child processes. … … 100 94 queue_class = Queue.Queue 101 95 manager_class = _InlineManager 102 elif worker_model == 'processes' and multiprocessing:96 elif worker_model == 'processes': 103 97 queue_class = multiprocessing.Queue 104 98 manager_class = _MultiProcessManager … … 246 240 247 241 248 if multiprocessing: 249 250 class _Process(multiprocessing.Process): 251 def __init__(self, worker_connection, platform_name, options, client): 252 multiprocessing.Process.__init__(self) 253 self._worker_connection = worker_connection 254 self._platform_name = platform_name 255 self._options = options 256 self._client = client 257 258 def run(self): 259 # We need to create a new Host object here because this is 260 # running in a new process and we can't require the parent's 261 # Host to be pickleable and passed to the child. 262 if self._platform_name.startswith('test'): 263 host = MockHost() 264 else: 265 host = Host() 266 host._initialize_scm() 267 268 options = self._options 269 port_obj = host.port_factory.get(self._platform_name, options) 270 271 # The unix multiprocessing implementation clones the 272 # log handler configuration into the child processes, 273 # but the win implementation doesn't. 274 configure_logging = (sys.platform == 'win32') 275 276 # FIXME: this won't work if the calling process is logging 277 # somewhere other than sys.stderr and sys.stdout, but I'm not sure 278 # if this will be an issue in practice. 279 printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging) 280 self._client.run(port_obj) 281 printer.cleanup() 242 class _Process(multiprocessing.Process): 243 def __init__(self, worker_connection, platform_name, options, client): 244 multiprocessing.Process.__init__(self) 245 self._worker_connection = worker_connection 246 self._platform_name = platform_name 247 self._options = options 248 self._client = client 249 250 def run(self): 251 # We need to create a new Host object here because this is 252 # running in a new process and we can't require the parent's 253 # Host to be pickleable and passed to the child. 254 if self._platform_name.startswith('test'): 255 host = MockHost() 256 else: 257 host = Host() 258 host._initialize_scm() 259 260 options = self._options 261 port_obj = host.port_factory.get(self._platform_name, options) 262 263 # The unix multiprocessing implementation clones the 264 # log handler configuration into the child processes, 265 # but the win implementation doesn't. 266 configure_logging = (sys.platform == 'win32') 267 268 # FIXME: this won't work if the calling process is logging 269 # somewhere other than sys.stderr and sys.stdout, but I'm not sure 270 # if this will be an issue in practice. 271 printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging) 272 self._client.run(port_obj) 273 printer.cleanup() 282 274 283 275 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py
r101667 r107151 32 32 import unittest 33 33 34 try:35 import multiprocessing36 except ImportError:37 multiprocessing = None38 39 40 34 from webkitpy.common.system import outputcapture 41 35 from webkitpy.common.host_mock import MockHost 42 43 36 from webkitpy.layout_tests import port 44 37 from webkitpy.layout_tests.controllers import manager_worker_broker … … 128 121 if sys.platform in ('cygwin', 'win32'): 129 122 return 130 131 if multiprocessing: 132 self.assertTrue(make_broker(self, 'processes') is not None) 133 else: 134 self.assertRaises(ValueError, make_broker, self, 'processes') 123 self.assertTrue(make_broker(self, 'processes') is not None) 135 124 136 125 def test_get__unknown(self): … … 206 195 207 196 # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54520. 208 if multiprocessing andsys.platform not in ('cygwin', 'win32'):197 if sys.platform not in ('cygwin', 'win32'): 209 198 210 199 class MultiProcessBrokerTests(_TestsMixin, unittest.TestCase): … … 212 201 _TestsMixin.setUp(self) 213 202 self._worker_model = 'processes' 214 215 def queue(self):216 return multiprocessing.Queue()217 203 218 204 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r107136 r107151 39 39 from webkitpy.common.memoized import memoized 40 40 from webkitpy.common.system import path 41 42 43 # Handle Python < 2.6 where multiprocessing isn't available.44 try:45 import multiprocessing46 except ImportError:47 multiprocessing = None48 49 41 from webkitpy.common import find_files 50 42 from webkitpy.common.system import logutils … … 149 141 self._test_configuration = None 150 142 self._reftest_list = {} 151 self._multiprocessing_is_available = (multiprocessing is not None)152 143 self._results_directory = None 153 144 … … 177 168 178 169 def default_worker_model(self): 179 if self._multiprocessing_is_available: 180 return 'processes' 181 return 'inline' 170 return 'processes' 182 171 183 172 def baseline_path(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
r105183 r107151 103 103 return result 104 104 105 def default_child_processes(self):106 if not self._multiprocessing_is_available:107 # Running multiple threads in Mac Python is unstable (See108 # https://bugs.webkit.org/show_bug.cgi?id=38553 for more info).109 return 1110 return chromium.ChromiumPort.default_child_processes(self)111 112 105 def operating_system(self): 113 106 return 'mac' -
trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r105183 r107151 31 31 import errno 32 32 import socket 33 34 33 import sys 35 34 import time 36 35 import unittest 37 36 38 # Handle Python < 2.6 where multiprocessing isn't available.39 try:40 import multiprocessing41 except ImportError:42 multiprocessing = None43 44 37 from webkitpy.layout_tests.servers import http_server_base 45 46 38 from webkitpy.common.system.filesystem_mock import MockFileSystem 47 39 from webkitpy.tool.mocktool import MockOptions … … 69 61 def test_default_worker_model(self): 70 62 port = self.make_port() 71 if multiprocessing: 72 self.assertEqual(port.default_worker_model(), 'processes') 73 else: 74 self.assertEqual(port.default_worker_model(), 'inline') 63 self.assertEqual(port.default_worker_model(), 'processes') 75 64 76 65 def test_driver_cmd_line(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py
r107139 r107151 44 44 from webkitpy.common.system import path 45 45 46 try:47 import multiprocessing48 except ImportError:49 multiprocessing = None50 51 46 # FIXME: remove this when we fix test-webkitpy to work properly on cygwin 52 47 # (bug 63846). 53 SHOULD_TEST_PROCESSES = multiprocessing andsys.platform not in ('cygwin', 'win32')48 SHOULD_TEST_PROCESSES = sys.platform not in ('cygwin', 'win32') 54 49 55 50 from webkitpy.common import array_stream
Note: See TracChangeset
for help on using the changeset viewer.