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

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

Issue 2678043002: Hide console log messages for imported WPT tests (Closed)
Patch Set: filter console messages in content_shell rather than python Created 3 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 c0cecf91e649efb7c4eaf6da535e08ca5702df7e..d116f1799db6509d3deefe4b0fe662d0e92c1a1d 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
@@ -207,6 +207,12 @@ class Driver(object):
if self.error_from_test:
crash_log += '\nstdout:\n%s\nstderr:\n%s\n' % (text, self.error_from_test)
+ # Filter console output for WPT tests into stderr so that tests not
+ # designed for it do not fail when console messages appear in a
+ # non-deterministic order.
+# if any(dir in driver_input.test_name for dir in self.FILTER_CONSOLE_DIRS):
+# text, self.error_from_test = self._filter_console_output_into_stderr(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,
@@ -215,6 +221,28 @@ class Driver(object):
leak=leaked, leak_log=self._leak_log,
pid=pid)
+ def _filter_console_output_into_stderr(self, out, stderr):
+ if out is None:
+ return None, stderr
+
+ new_out = ''
+ console_output = ''
+
+ for line in out.splitlines():
+ line += '\n'
+ if line.startswith('CONSOLE'):
+ console_output += line
+ else:
+ new_out += line
+
+ if console_output:
+ if stderr:
+ stderr += '\n'
+
+ stderr = stderr + 'Console Output:\n' + console_output
+
+ return new_out, stderr
+
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)
@@ -228,6 +256,11 @@ class Driver(object):
HTTP_DIR = "http/tests/"
HTTP_LOCAL_DIR = "http/tests/local/"
WPT_DIR = "external/wpt/"
+ FILTER_CONSOLE_DIRS = [
+ WPT_DIR,
+ 'harness-tests/wpt',
+ ]
+
def is_http_test(self, test_name):
return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(self.HTTP_LOCAL_DIR)

Powered by Google App Engine
This is Rietveld 408576698