Changeset 88671 in webkit
- Timestamp:
- Jun 13, 2011 12:15:27 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r88661 r88671 1 2011-06-13 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 webkitpy: add integration tests for new-run-webkit-httpd, stop calling shut_down_http_server 6 https://bugs.webkit.org/show_bug.cgi?id=62251 7 8 shut_down_http_server() was a total hack that was only used by 9 new-run-webkit-httpd, so I've moved the code there and switched 10 to using executive.kill_process() for the common case. The 11 method itself will be removed in the patch on bug 59993. 12 13 * Scripts/new-run-webkit-httpd: 14 * Scripts/webkitpy/layout_tests/port/apache_http_server.py: 15 * Scripts/webkitpy/layout_tests/port/http_server.py: 16 * Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py: Added. 17 * Scripts/webkitpy/layout_tests/port/websocket_server.py: 18 1 19 2011-06-13 Tony Chang <tony@chromium.org> 2 20 -
trunk/Tools/Scripts/new-run-webkit-httpd
r81834 r88671 71 71 httpd.start() 72 72 else: 73 httpd.stop(force=True) 74 73 # FIXME: We use _shut_down_http_server() instead of stop_http_server() 74 # because stop() only works if start() was called previously in the 75 # same process. _shut_down() is too coarse and may kill unrelated 76 # web servers, so this is a hack. We should change the interface so we 77 # can rely on pid files or something. 78 port_obj._shut_down_http_server(None) 75 79 76 80 def main(): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
r85665 r88671 228 228 _log.debug("Shutting down any running http servers") 229 229 httpd_pid = None 230 if os.path.exists(self._pid_file): 230 if self._httpd_proc: 231 httpd_pid = self._httpd_proc.pid 232 elif os.path.exists(self._pid_file): 231 233 httpd_pid = int(open(self._pid_file).readline()) 232 # FIXME: We shouldn't be calling a protected method of _port_obj!233 self._port_obj._shut_down_http_server(httpd_pid)234 if httpd_pid: 235 self._executive.kill_process(httpd_pid) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server.py
r85665 r88671 227 227 # probably not being flushed, etc... why doesn't our python have os.kill ? 228 228 229 def stop(self , force=False):230 if not force and notself.is_running():229 def stop(self): 230 if not self.is_running(): 231 231 return 232 232 … … 234 234 if self._process: 235 235 httpd_pid = self._process.pid 236 self._ port_obj._shut_down_http_server(httpd_pid)236 self._executive.kill_process(httpd_pid) 237 237 238 238 if self._process: -
trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py
r85665 r88671 44 44 def __init__(self, port_obj): 45 45 self._port_obj = port_obj 46 self._executive = port_obj._executive 46 47 47 48 def wait_for_action(self, action): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r85896 r88671 49 49 class PortTestCase(unittest.TestCase): 50 50 """Tests that all Port implementations must pass.""" 51 52 HTTP_PORTS = [8000, 8080, 8443] 53 WEBSOCKET_PORTS = [8880] 51 HTTP_PORTS = (8000, 8080, 8443) 52 WEBSOCKET_PORTS = (8880,) 54 53 55 54 def port_maker(self, platform): … … 93 92 for port in ports: 94 93 try: 95 s= socket.socket()96 s.connect((host, port))94 test_socket = socket.socket() 95 test_socket.connect((host, port)) 97 96 self.fail() 98 97 except IOError, e: 99 98 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET)) 100 99 finally: 101 s.close()100 test_socket.close() 102 101 103 102 def assert_servers_are_up(self, host, ports): 104 103 for port in ports: 105 104 try: 106 s= socket.socket()107 s.connect((host, port))105 test_socket = socket.socket() 106 test_socket.connect((host, port)) 108 107 except IOError, e: 109 108 self.fail('failed to connect to %s:%d' % (host, port)) 110 109 finally: 111 s.close()110 test_socket.close() 112 111 113 112 def integration_test_http_lock(self): … … 138 137 if not port: 139 138 return 140 141 139 self.assert_servers_are_down('localhost', self.HTTP_PORTS) 142 140 port.start_http_server() … … 149 147 if not port: 150 148 return 151 152 149 # Test that if a port isn't available, the call fails. 153 150 for port_number in self.HTTP_PORTS: 154 s= socket.socket()151 test_socket = socket.socket() 155 152 try: 156 153 try: 157 s.bind(('localhost', port_number))154 test_socket.bind(('localhost', port_number)) 158 155 except socket.error, e: 159 156 if e.errno in (errno.EADDRINUSE, errno.EALREADY): … … 167 164 finally: 168 165 port.stop_http_server() 169 s.close()166 test_socket.close() 170 167 171 168 # Test that calling start() twice fails. … … 261 258 # Test that start() fails if a port isn't available. 262 259 for port_number in self.WEBSOCKET_PORTS: 263 s= socket.socket()264 try: 265 s.bind(('localhost', port_number))260 test_socket = socket.socket() 261 try: 262 test_socket.bind(('localhost', port_number)) 266 263 try: 267 264 port.start_websocket_server() … … 271 268 finally: 272 269 port.stop_websocket_server() 273 s.close()270 test_socket.close() 274 271 275 272 # Test that calling start() twice fails. -
trunk/Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py
r85665 r88671 210 210 if not url_is_alive(url): 211 211 if self._process.returncode == None: 212 # FIXME: We should use a non-static Executive for easier 213 # testing. 214 Executive().kill_process(self._process.pid) 212 self._executive.kill_process(self._process.pid) 215 213 with codecs.open(output_log, "r", "utf-8") as fp: 216 214 for line in fp: … … 228 226 file.write("%d" % self._process.pid) 229 227 230 def stop(self , force=False):231 if not force and notself.is_running():228 def stop(self): 229 if not self.is_running(): 232 230 return 233 231 … … 244 242 245 243 _log.debug('Shutting down %s server %d.' % (self._server_name, pid)) 246 # FIXME: We should use a non-static Executive for easier testing. 247 Executive().kill_process(pid) 244 self._executive.kill_process(pid) 248 245 249 246 if self._process:
Note: See TracChangeset
for help on using the changeset viewer.