Changeset 107151 in webkit


Ignore:
Timestamp:
Feb 8, 2012 4:27:36 PM (12 years ago)
Author:
abarth@webkit.org
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_getprocesses):
(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:
Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r107150 r107151  
     12012-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
    1272012-02-08  Gustavo Noronha Silva  <gns@gnome.org>
    228
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py

    r103289 r107151  
    4343
    4444import logging
     45import multiprocessing
    4546import optparse
    4647import Queue
    4748import sys
    48 
    49 
    50 # Handle Python < 2.6 where multiprocessing isn't available.
    51 try:
    52     import multiprocessing
    53 except ImportError:
    54     multiprocessing = None
    5549
    5650# These are needed when workers are launched in new child processes.
     
    10094        queue_class = Queue.Queue
    10195        manager_class = _InlineManager
    102     elif worker_model == 'processes' and multiprocessing:
     96    elif worker_model == 'processes':
    10397        queue_class = multiprocessing.Queue
    10498        manager_class = _MultiProcessManager
     
    246240
    247241
    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()
     242class _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()
    282274
    283275
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py

    r101667 r107151  
    3232import unittest
    3333
    34 try:
    35     import multiprocessing
    36 except ImportError:
    37     multiprocessing = None
    38 
    39 
    4034from webkitpy.common.system import outputcapture
    4135from webkitpy.common.host_mock import MockHost
    42 
    4336from webkitpy.layout_tests import port
    4437from webkitpy.layout_tests.controllers import manager_worker_broker
     
    128121        if sys.platform in ('cygwin', 'win32'):
    129122            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)
    135124
    136125    def test_get__unknown(self):
     
    206195
    207196# FIXME: https://bugs.webkit.org/show_bug.cgi?id=54520.
    208 if multiprocessing and sys.platform not in ('cygwin', 'win32'):
     197if sys.platform not in ('cygwin', 'win32'):
    209198
    210199    class MultiProcessBrokerTests(_TestsMixin, unittest.TestCase):
     
    212201            _TestsMixin.setUp(self)
    213202            self._worker_model = 'processes'
    214 
    215         def queue(self):
    216             return multiprocessing.Queue()
    217203
    218204
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r107136 r107151  
    3939from webkitpy.common.memoized import memoized
    4040from webkitpy.common.system import path
    41 
    42 
    43 # Handle Python < 2.6 where multiprocessing isn't available.
    44 try:
    45     import multiprocessing
    46 except ImportError:
    47     multiprocessing = None
    48 
    4941from webkitpy.common import find_files
    5042from webkitpy.common.system import logutils
     
    149141        self._test_configuration = None
    150142        self._reftest_list = {}
    151         self._multiprocessing_is_available = (multiprocessing is not None)
    152143        self._results_directory = None
    153144
     
    177168
    178169    def default_worker_model(self):
    179         if self._multiprocessing_is_available:
    180             return 'processes'
    181         return 'inline'
     170        return 'processes'
    182171
    183172    def baseline_path(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py

    r105183 r107151  
    103103        return result
    104104
    105     def default_child_processes(self):
    106         if not self._multiprocessing_is_available:
    107             # Running multiple threads in Mac Python is unstable (See
    108             # https://bugs.webkit.org/show_bug.cgi?id=38553 for more info).
    109             return 1
    110         return chromium.ChromiumPort.default_child_processes(self)
    111 
    112105    def operating_system(self):
    113106        return 'mac'
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py

    r105183 r107151  
    3131import errno
    3232import socket
    33 
    3433import sys
    3534import time
    3635import unittest
    3736
    38 # Handle Python < 2.6 where multiprocessing isn't available.
    39 try:
    40     import multiprocessing
    41 except ImportError:
    42     multiprocessing = None
    43 
    4437from webkitpy.layout_tests.servers import http_server_base
    45 
    4638from webkitpy.common.system.filesystem_mock import MockFileSystem
    4739from webkitpy.tool.mocktool import MockOptions
     
    6961    def test_default_worker_model(self):
    7062        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')
    7564
    7665    def test_driver_cmd_line(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r107139 r107151  
    4444from webkitpy.common.system import path
    4545
    46 try:
    47     import multiprocessing
    48 except ImportError:
    49     multiprocessing = None
    50 
    5146# FIXME: remove this when we fix test-webkitpy to work properly on cygwin
    5247# (bug 63846).
    53 SHOULD_TEST_PROCESSES = multiprocessing and sys.platform not in ('cygwin', 'win32')
     48SHOULD_TEST_PROCESSES = sys.platform not in ('cygwin', 'win32')
    5449
    5550from webkitpy.common import array_stream
Note: See TracChangeset for help on using the changeset viewer.