Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py

Issue 2649433002: When killing wptserve, use Executive.interrupt on non-Windows platforms. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py
index 56424507d144d7612cbcfcf51d4b3bc16bdb3c9e..c0efd2a06333b1d7bdfcffe865a3308e1698b043 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py
@@ -6,9 +6,13 @@
import datetime
import logging
+
from webkitpy.layout_tests.servers import server_base
+_log = logging.getLogger(__name__)
+
+
class WPTServe(server_base.ServerBase):
def __init__(self, port_obj, output_dir):
@@ -57,3 +61,34 @@ class WPTServe(server_base.ServerBase):
'Pre-generated keys and certificates are going to be expired at %s.'
' Please re-generate them by following steps in %s/README.chromium.'
% (expiration_date.strftime('%b %d %Y'), path_to_wpt_support))
+
+ def _stop_running_server(self):
+ self._wait_for_action(self._check_and_kill_wptserve)
+ if self._filesystem.exists(self._pid_file):
+ self._filesystem.remove(self._pid_file)
+
+ def _check_and_kill_wptserve(self):
+ """Tries to kill wptserve.
+
+ Returns True if it appears to be not running. Or, if it appears to be
+ running, tries to kill the process and returns False.
+ """
+ if not (self._pid and self._executive.check_running_pid(self._pid)):
+ _log.debug('pid %d is not running', self._pid)
+ return True
+
+ _log.debug('pid %d is running, killing it', self._pid)
+
+ # Executive.kill_process appears to not to effectively kill the
+ # wptserve processes on Linux (and presumably other platforms).
+ if self._platform.is_win():
+ self._executive.kill_process(self._pid)
+ else:
+ self._executive.interrupt(self._pid)
+
+ # According to Popen.wait(), this can deadlock when using stdout=PIPE or
+ # stderr=PIPE. We're using DEVNULL for both so that should not occur.
+ if self._process is not None:
+ self._process.wait()
+
+ return False
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698