Changeset 57444 in webkit
- Timestamp:
- Apr 10, 2010 11:52:12 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r57443 r57444 1 2010-04-10 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 kill_process is copy/pasted in five places 6 https://bugs.webkit.org/show_bug.cgi?id=37405 7 8 We shouldn't replicate the kill_process logic in every port. Instead, 9 we should move the process interaction to Executive. 10 11 Dirk mentioned that he wanted this abstraction to make it easier to 12 mock things out for testing. It turns out this function is only used 13 in one place where it can't be used as a mock point for testing because 14 the corresponding create process actually creates a real process. In 15 the long term, we should indirect both these calls through a non-static 16 Executive as a mock point. However, we should wait on that until we 17 actually want to write the test. 18 19 * Scripts/webkitpy/layout_tests/port/base.py: 20 * Scripts/webkitpy/layout_tests/port/chromium_linux.py: 21 * Scripts/webkitpy/layout_tests/port/chromium_mac.py: 22 * Scripts/webkitpy/layout_tests/port/chromium_win.py: 23 * Scripts/webkitpy/layout_tests/port/mac.py: 24 * Scripts/webkitpy/layout_tests/port/websocket_server.py: 25 * Scripts/webkitpy/layout_tests/port/win.py: 26 1 27 2010-04-10 Adam Barth <abarth@webkit.org> 2 28 -
trunk/WebKitTools/Scripts/webkitpy/common/system/executive.py
r57427 r57444 139 139 return 2 140 140 141 def kill_process(self, pid): 142 if platform.system() == "Windows": 143 # According to http://docs.python.org/library/os.html 144 # os.kill isn't available on Windows. However, when I tried it 145 # using Cygwin, it worked fine. We should investigate whether 146 # we need this platform specific code here. 147 subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)), 148 stdin=open(os.devnull, 'r'), 149 stdout=subprocess.PIPE, 150 stderr=subprocess.PIPE) 151 return 152 os.kill(pid, signal.SIGKILL) 153 141 154 # Error handlers do not need to be static methods once all callers are 142 155 # updated to use an Executive object. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
r57422 r57444 573 573 # 574 574 575 def _kill_process(self, pid):576 """Forcefully kill a process.577 578 This routine should not be used or needed generically, but can be579 used in helper files like http_server.py."""580 raise NotImplementedError('Port.kill_process')581 582 575 def _path_to_apache(self): 583 576 """Returns the full path to the apache binary. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
r57399 r57444 126 126 127 127 128 def _kill_process(self, pid):129 """Forcefully kill the process.130 131 Args:132 pid: The id of the process to be killed.133 """134 os.kill(pid, signal.SIGKILL)135 136 128 def _kill_all_process(self, process_name): 137 129 null = open(os.devnull) -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
r57399 r57444 106 106 'mac', *comps) 107 107 108 def _kill_process(self, pid):109 """Forcefully kill the process.110 111 Args:112 pid: The id of the process to be killed.113 """114 os.kill(pid, signal.SIGKILL)115 116 108 def _kill_all_process(self, process_name): 117 109 """Kill any processes running under this name.""" -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
r57399 r57444 111 111 *comps) 112 112 113 def _kill_process(self, pid):114 """Forcefully kill the process.115 116 Args:117 pid: The id of the process to be killed.118 """119 subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)),120 stdin=open(os.devnull, 'r'),121 stdout=subprocess.PIPE,122 stderr=subprocess.PIPE)123 124 113 def _path_to_apache(self): 125 114 return self.path_from_chromium_base('third_party', 'cygwin', 'usr', -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
r57426 r57444 145 145 146 146 # FIXME: This doesn't have anything to do with WebKit. 147 def _kill_process(self, pid):148 """Forcefully kill the process.149 150 Args:151 pid: The id of the process to be killed.152 """153 os.kill(pid, signal.SIGKILL)154 155 # FIXME: This doesn't have anything to do with WebKit.156 147 def _kill_all_process(self, process_name): 157 148 # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
r57423 r57444 43 43 import http_server 44 44 45 from webkitpy.common.system.executive import Executive 46 45 47 _log = logging.getLogger("webkitpy.layout_tests.port.websocket_server") 46 48 … … 201 203 self._server_name, self._port)) 202 204 _log.debug('cmdline: %s' % ' '.join(start_cmd)) 205 # FIXME: We should direct this call through Executive for testing. 203 206 self._process = subprocess.Popen(start_cmd, 204 207 stdin=open(os.devnull, 'r'), … … 251 254 252 255 _log.debug('Shutting down %s server %d.' % (self._server_name, pid)) 253 # FIXME: We should n't be calling a protected method of the port_obj!254 self._port_obj._kill_process(pid)256 # FIXME: We should use a non-static Executive for easier testing. 257 Executive().kill_process(pid) 255 258 256 259 if self._process: -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/win.py
r57426 r57444 84 84 return disabled_feature_tests + webarchive_tests 85 85 86 # FIXME: This doesn't have anything to do with WebKit.87 # FIXME: Copy/pasted from chromium-win88 def _kill_process(self, pid):89 """Forcefully kill the process.90 91 Args:92 pid: The id of the process to be killed.93 """94 subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)),95 stdin=open(os.devnull, 'r'),96 stdout=subprocess.PIPE,97 stderr=subprocess.PIPE)98 99 86 def _path_to_apache_config_file(self): 100 87 return os.path.join(self.layout_tests_dir(), 'http', 'conf',
Note: See TracChangeset
for help on using the changeset viewer.