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

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 only console output from WPT tests into stderr Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..32dfb8d1324ba5a1196eecbe1b011a4b168e94d5 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 self.WPT_DIR in driver_input.test_name:
+ 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
qyearsley 2017/02/16 18:54:43 Console messages can have newlines in them -- so f
Dan Elphick 2017/02/17 15:04:40 Just checked and this changes fails for new lines.
+
+ 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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698