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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py

Issue 1806393002: Run yapf on files in webkit/layout_tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py
index 3fd0e6ca577c7a571f83a20b9e488b98b1bc8ecc..a0514bd3001c5fe06749ed456c128024098759d5 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py
@@ -38,10 +38,8 @@ import os
from webkitpy.common.system import path
from webkitpy.common.system.profiler import ProfilerFactory
-
_log = logging.getLogger(__name__)
-
DRIVER_START_TIMEOUT_SECS = 30
@@ -58,9 +56,22 @@ class DriverOutput(object):
"""Groups information about a output from driver for easy passing
and post-processing of data."""
- def __init__(self, text, image, image_hash, audio, crash=False,
- test_time=0, measurements=None, timeout=False, error='', crashed_process_name='??',
- crashed_pid=None, crash_log=None, leak=False, leak_log=None, pid=None):
+ def __init__(self,
+ text,
+ image,
+ image_hash,
+ audio,
+ crash=False,
+ test_time=0,
+ measurements=None,
+ timeout=False,
+ error='',
+ crashed_process_name='??',
+ crashed_pid=None,
+ crash_log=None,
+ leak=False,
+ leak_log=None,
+ pid=None):
# FIXME: Args could be renamed to better clarify what they do.
self.text = text
self.image = image # May be empty-string if the test crashes.
@@ -132,8 +143,8 @@ class Driver(object):
self._measurements = {}
if self._port.get_option("profile"):
profiler_name = self._port.get_option("profiler")
- self._profiler = ProfilerFactory.create_profiler(self._port.host,
- self._port._path_to_driver(), self._port.results_directory(), profiler_name)
+ self._profiler = ProfilerFactory.create_profiler(self._port.host, self._port._path_to_driver(),
+ self._port.results_directory(), profiler_name)
else:
self._profiler = None
@@ -203,13 +214,21 @@ class Driver(object):
if self.error_from_test:
crash_log += '\nstdout:\n%s\nstderr:\n%s\n' % (text, self.error_from_test)
- return DriverOutput(text, image, actual_image_hash, audio,
- crash=crashed, test_time=time.time() - test_begin_time, measurements=self._measurements,
- timeout=timed_out, error=self.error_from_test,
- crashed_process_name=self._crashed_process_name,
- crashed_pid=self._crashed_pid, crash_log=crash_log,
- leak=leaked, leak_log=self._leak_log,
- pid=pid)
+ return DriverOutput(text,
+ image,
+ actual_image_hash,
+ audio,
+ crash=crashed,
+ test_time=time.time() - test_begin_time,
+ measurements=self._measurements,
+ timeout=timed_out,
+ error=self.error_from_test,
+ crashed_process_name=self._crashed_process_name,
+ crashed_pid=self._crashed_pid,
+ crash_log=crash_log,
+ leak=leaked,
+ leak_log=self._leak_log,
+ pid=pid)
def _get_crash_log(self, stdout, stderr, newer_than):
return self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, stdout, stderr, newer_than)
@@ -319,7 +338,11 @@ class Driver(object):
self._leaked = False
self._leak_log = None
cmd_line = self.cmd_line(pixel_tests, per_test_args)
- self._server_process = self._port._server_process_constructor(self._port, server_name, cmd_line, environment, logging=self._port.get_option("driver_logging"))
+ self._server_process = self._port._server_process_constructor(self._port,
+ server_name,
+ cmd_line,
+ environment,
+ logging=self._port.get_option("driver_logging"))
self._server_process.start()
self._current_cmd_line = cmd_line
@@ -382,8 +405,7 @@ class Driver(object):
# See http://trac.webkit.org/changeset/65537.
self._crashed_process_name = self._server_process.name()
self._crashed_pid = self._server_process.pid()
- elif (error_line.startswith("#CRASHED - ")
- or error_line.startswith("#PROCESS UNRESPONSIVE - ")):
+ elif (error_line.startswith("#CRASHED - ") or error_line.startswith("#PROCESS UNRESPONSIVE - ")):
# WebKitTestRunner uses this to report that the WebProcess subprocess crashed.
match = re.match('#(?:CRASHED|PROCESS UNRESPONSIVE) - (\S+)', error_line)
self._crashed_process_name = match.group(1) if match else 'WebProcess'
@@ -409,7 +431,8 @@ class Driver(object):
def _command_from_driver_input(self, driver_input):
# FIXME: performance tests pass in full URLs instead of test names.
- if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://') or driver_input.test_name == ('about:blank'):
+ if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith(
+ 'https://') or driver_input.test_name == ('about:blank'):
command = driver_input.test_name
elif self.is_http_test(driver_input.test_name) or self._should_treat_as_wpt_test(driver_input.test_name):
command = self.test_to_uri(driver_input.test_name)
@@ -457,13 +480,13 @@ class Driver(object):
return False
def _process_stdout_line(self, block, line):
- if (self._read_header(block, line, 'Content-Type: ', 'content_type')
- or self._read_header(block, line, 'Content-Transfer-Encoding: ', 'encoding')
- or self._read_header(block, line, 'Content-Length: ', '_content_length', int)
- or self._read_header(block, line, 'ActualHash: ', 'content_hash')
- or self._read_header(block, line, 'DumpMalloc: ', 'malloc')
- or self._read_header(block, line, 'DumpJSHeap: ', 'js_heap')
- or self._read_header(block, line, 'StdinPath', 'stdin_path')):
+ if (self._read_header(block, line, 'Content-Type: ', 'content_type') or
+ self._read_header(block, line, 'Content-Transfer-Encoding: ', 'encoding') or
+ self._read_header(block, line, 'Content-Length: ', '_content_length', int) or
+ self._read_header(block, line, 'ActualHash: ', 'content_hash') or
+ self._read_header(block, line, 'DumpMalloc: ', 'malloc') or
+ self._read_header(block, line, 'DumpJSHeap: ', 'js_heap') or
+ self._read_header(block, line, 'StdinPath', 'stdin_path')):
return
# Note, we're not reading ExpectedHash: here, but we could.
# If the line wasn't a header, we just append it to the content.
@@ -506,7 +529,8 @@ class Driver(object):
if out_line:
if out_line[-1] != "\n":
- _log.error("Last character read from DRT stdout line was not a newline! This indicates either a NRWT or DRT bug.")
+ _log.error(
+ "Last character read from DRT stdout line was not a newline! This indicates either a NRWT or DRT bug.")
content_length_before_header_check = block._content_length
self._process_stdout_line(block, out_line)
# FIXME: Unlike HTTP, DRT dumps the content right after printing a Content-Length header.

Powered by Google App Engine
This is Rietveld 408576698