⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278332 in webkit


Ignore:
Timestamp:
Jun 1, 2021, 4:23:21 PM (5 years ago)
Author:
Jonathan Bedard
Message:

[run-webkit-tests] Move helper out of Port instance
https://bugs.webkit.org/show_bug.cgi?id=226344
<rdar://problem/78575542>

Reviewed by Dewei Zhu.

The "helper" is a popen object, which are not pickleable, and cannot
belong to an instantiated port object.

  • Scripts/webkitpy/port/base.py:

(Port): Make helper class variable.
(Port.init):
(Port.stop_helper): All classes should share the same code to stop the helper process.

  • Scripts/webkitpy/port/mac.py:

(MacPort.start_helper): Use class variable.
(MacPort.stop_helper): Moved to base class..

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r278322 r278332  
     12021-06-01  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [run-webkit-tests] Move helper out of Port instance
     4        https://bugs.webkit.org/show_bug.cgi?id=226344
     5        <rdar://problem/78575542>
     6
     7        Reviewed by Dewei Zhu.
     8
     9        The "helper" is a popen object, which are not pickleable, and cannot
     10        belong to an instantiated port object.
     11
     12        * Scripts/webkitpy/port/base.py:
     13        (Port): Make helper class variable.
     14        (Port.__init__):
     15        (Port.stop_helper): All classes should share the same code to stop the helper process.
     16        * Scripts/webkitpy/port/mac.py:
     17        (MacPort.start_helper): Use class variable.
     18        (MacPort.stop_helper): Moved to base class..
     19
    1202021-06-01  Fujii Hironori  <Hironori.Fujii@sony.com>
    221
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r277781 r278332  
    576576
    577577        _log.debug("Restarting helper")
    578         self._port.stop_helper()
    579578        self._options.pixel_tests = True
    580579        return self._port.start_helper(prefer_integrated_gpu=self._options.prefer_integrated_gpu)
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r278174 r278332  
    8282    DEFAULT_DEVICE_TYPES = []
    8383
     84    helper = None
     85
    8486    @classmethod
    8587    def determine_full_port_name(cls, host, options, port_name):
     
    116118        self.pretty_patch = PrettyPatch(self._executive, self.path_from_webkit_base(), self._filesystem)
    117119
    118         self._helper = None
    119120        self._http_server = None
    120121        self._websocket_server = None
     
    959960    def stop_helper(self):
    960961        """Shut down the test helper if it is running. Do nothing if
    961         it isn't, or it isn't available. If a port overrides start_helper()
    962         it must override this routine as well."""
    963         pass
     962        it isn't, or it isn't available."""
     963        if Port.helper:
     964            _log.debug("Stopping LayoutTestHelper")
     965            try:
     966                Port.helper.stdin.write(b"x\n")
     967                Port.helper.stdin.close()
     968                Port.helper.wait()
     969            except IOError as e:
     970                _log.debug("IOError raised while stopping helper: %s" % str(e))
     971            Port.helper = None
    964972
    965973    def stop_http_server(self):
  • trunk/Tools/Scripts/webkitpy/port/mac.py

    r274754 r278332  
    3838from webkitpy.common.version_name_map import PUBLIC_TABLE, INTERNAL_TABLE
    3939from webkitpy.common.version_name_map import VersionNameMap
     40from webkitpy.port.base import Port
    4041from webkitpy.port.config import apple_additions, Config
    4142from webkitpy.port.darwin import DarwinPort
     
    246247
    247248    def start_helper(self, pixel_tests=False, prefer_integrated_gpu=False):
     249        self.stop_helper()
     250
    248251        helper_path = self._path_to_helper()
    249252        if not helper_path:
     
    254257        if prefer_integrated_gpu:
    255258            arguments.append('--prefer-integrated-gpu')
    256         self._helper = self._executive.popen(arguments,
     259        Port.helper = self._executive.popen(arguments,
    257260            stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=None)
    258         is_ready = self._helper.stdout.readline()
     261        is_ready = Port.helper.stdout.readline()
    259262        if not is_ready.startswith(b'ready'):
    260263            _log.error("LayoutTestHelper could not start")
     
    272275                if e.exit_code != 1:
    273276                    raise e
    274 
    275     def stop_helper(self):
    276         if self._helper:
    277             _log.debug("Stopping LayoutTestHelper")
    278             try:
    279                 self._helper.stdin.write(b"x\n")
    280                 self._helper.stdin.close()
    281                 self._helper.wait()
    282             except IOError as e:
    283                 _log.debug("IOError raised while stopping helper: %s" % str(e))
    284             self._helper = None
    285277
    286278    def logging_patterns_to_strip(self):
Note: See TracChangeset for help on using the changeset viewer.