Changeset 90078 in webkit
- Timestamp:
- Jun 29, 2011, 6:48:44 PM (14 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90077 r90078 1 2011-06-29 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Refactor WebKitDriver.run_test into smaller pieces 6 https://bugs.webkit.org/show_bug.cgi?id=63673 7 8 There is no functional change here. Just moving code around. 9 This is in preparation for adding support for #CRASHED and #CRASHED - WebProcess 10 11 * Scripts/webkitpy/layout_tests/port/webkit.py: 12 1 13 2011-06-29 Eric Seidel <eric@webkit.org> 2 14 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r90077 r90078 408 408 # FIXME: We're assuming that WebKitTestRunner checks this DumpRenderTree-named environment variable. 409 409 environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) 410 self._server_process = server_process.ServerProcess(self._port, 411 self._port.driver_name(), self.cmd_line(), environment) 410 self._server_process = server_process.ServerProcess(self._port, self._port.driver_name(), self.cmd_line(), environment) 412 411 413 412 def poll(self): … … 419 418 return 420 419 421 # FIXME: This function is huge. 420 def detected_crash(self): 421 # FIXME: We can't just check self._server_process.crashed for two reasons: 422 # 1. WebKitTestRunner will print "#CRASHED - WebProcess" and then exit if the WebProcess crashes. 423 # 2. Adam Roben tells me Windows DumpRenderTree can print "#CRASHED" yet still exit cleanly. 424 return self._server_process.crashed 425 426 def _command_from_driver_input(self, driver_input): 427 uri = self._port.filename_to_uri(driver_input.filename) 428 command = uri[7:] if uri.startswith("file:///") else uri 429 430 if driver_input.image_hash: 431 # FIXME: Why the leading quote? 432 command += "'" + driver_input.image_hash 433 return command + "\n" 434 435 def _read_first_block(self, deadline): 436 """Reads a block from the server_process and returns (text_content, audio_content).""" 437 if self.detected_crash(): 438 return (None, None) 439 440 block = self._read_block(deadline) 441 if block.content_type == 'audio/wav': 442 return (None, block.decoded_content) 443 return (block.decoded_content, None) 444 445 def _read_optional_image_block(self, deadline): 446 """Reads a block from the server_process and returns (image, actual_image_hash).""" 447 if self.detected_crash(): 448 return (None, None) 449 450 block = self._read_block(deadline) 451 if block.content and block.content_type == 'image/png': 452 return (block.decoded_content, block.content_hash) 453 return (None, block.content_hash) 454 422 455 def run_test(self, driver_input): 423 uri = self._port.filename_to_uri(driver_input.filename) 424 if uri.startswith("file:///"): 425 command = uri[7:] 426 else: 427 command = uri 428 429 if driver_input.image_hash: 430 command += "'" + driver_input.image_hash 431 command += "\n" 432 456 command = self._command_from_driver_input(driver_input) 433 457 start_time = time.time() 458 deadline = time.time() + int(driver_input.timeout) / 1000.0 459 434 460 self._server_process.write(command) 435 436 text = None 437 image = None 438 actual_image_hash = None 439 audio = None 440 deadline = time.time() + int(driver_input.timeout) / 1000.0 441 442 # First block is either text or audio 443 if not self._server_process.crashed: 444 block = self._read_block(deadline) 445 if block.content_type == 'audio/wav': 446 audio = block.decoded_content 447 else: 448 text = block.decoded_content 449 450 # Now read an optional second block of image data 451 if not self._server_process.crashed: 452 block = self._read_block(deadline) 453 if block.content and block.content_type == 'image/png': 454 image = block.decoded_content 455 actual_image_hash = block.content_hash 456 elif block.content_hash: 457 actual_image_hash = block.content_hash 461 text, audio = self._read_first_block(deadline) # First block is either text or audio 462 image, actual_image_hash = self._read_optional_image_block(deadline) # The second (optional) block is image data. 458 463 459 464 error_lines = self._server_process.error.splitlines() … … 465 470 error = "\n".join(error_lines) 466 471 467 # FIXME: This seems like the wrong section of code to be doing this reset in.472 # FIXME: This seems like the wrong section of code to be resetting _server_process.error. 468 473 self._server_process.error = "" 469 474 return base.DriverOutput(text, image, actual_image_hash, audio, 470 crash=self. _server_process.crashed, test_time=time.time() - start_time,475 crash=self.detected_crash(), test_time=time.time() - start_time, 471 476 timeout=self._server_process.timed_out, error=error) 472 477 … … 487 492 line = self._server_process.read_line(timeout) 488 493 eof = False 489 while (not self._server_process.timed_out and not self. _server_process.crashedand not eof):494 while (not self._server_process.timed_out and not self.detected_crash() and not eof): 490 495 chomped_line = line.rstrip() 491 496 if chomped_line.endswith("#EOF"):
Note:
See TracChangeset
for help on using the changeset viewer.