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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 pid_str = str(self._crashed_pid) if self._crashed_pid else "unkn own pid" 200 pid_str = str(self._crashed_pid) if self._crashed_pid else "unkn own pid"
201 crash_log = 'No crash log found for %s:%s.\n' % (self._crashed_p rocess_name, pid_str) 201 crash_log = 'No crash log found for %s:%s.\n' % (self._crashed_p rocess_name, pid_str)
202 # If we were unresponsive append a message informing there may n ot have been a crash. 202 # If we were unresponsive append a message informing there may n ot have been a crash.
203 if self._subprocess_was_unresponsive: 203 if self._subprocess_was_unresponsive:
204 crash_log += 'Process failed to become responsive before tim ing out.\n' 204 crash_log += 'Process failed to become responsive before tim ing out.\n'
205 205
206 # Print stdout and stderr to the placeholder crash log; we want as much context as possible. 206 # Print stdout and stderr to the placeholder crash log; we want as much context as possible.
207 if self.error_from_test: 207 if self.error_from_test:
208 crash_log += '\nstdout:\n%s\nstderr:\n%s\n' % (text, self.er ror_from_test) 208 crash_log += '\nstdout:\n%s\nstderr:\n%s\n' % (text, self.er ror_from_test)
209 209
210 # filter console output for WPT tests into stderr so that tests not
211 # designed for it do not fail when console messages appear in a
212 # non-deterministic order.
213 if self.WPT_DIR in driver_input.test_name:
214 text, self.error_from_test = self._filter_console_output_into_stderr (text, self.error_from_test)
215
210 return DriverOutput(text, image, actual_image_hash, audio, 216 return DriverOutput(text, image, actual_image_hash, audio,
211 crash=crashed, test_time=time.time() - test_begin_ti me, measurements=self._measurements, 217 crash=crashed, test_time=time.time() - test_begin_ti me, measurements=self._measurements,
212 timeout=timed_out, error=self.error_from_test, 218 timeout=timed_out, error=self.error_from_test,
213 crashed_process_name=self._crashed_process_name, 219 crashed_process_name=self._crashed_process_name,
214 crashed_pid=self._crashed_pid, crash_log=crash_log, 220 crashed_pid=self._crashed_pid, crash_log=crash_log,
215 leak=leaked, leak_log=self._leak_log, 221 leak=leaked, leak_log=self._leak_log,
216 pid=pid) 222 pid=pid)
217 223
224 def _filter_console_output_into_stderr(self, out, stderr):
225 if out is None:
226 return None, stderr
227
228 new_out = ''
229 console_output = ''
230
231 for line in out.splitlines():
232 line += '\n'
233 if line.startswith('CONSOLE'):
234 console_output += line
235 else:
236 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.
237
238 if console_output:
239 if stderr:
240 stderr += '\n'
241
242 stderr = stderr + 'Console Output:\n' + console_output
243
244 return new_out, stderr
245
218 def _get_crash_log(self, stdout, stderr, newer_than): 246 def _get_crash_log(self, stdout, stderr, newer_than):
219 return self._port._get_crash_log(self._crashed_process_name, self._crash ed_pid, stdout, stderr, newer_than) 247 return self._port._get_crash_log(self._crashed_process_name, self._crash ed_pid, stdout, stderr, newer_than)
220 248
221 # FIXME: Seems this could just be inlined into callers. 249 # FIXME: Seems this could just be inlined into callers.
222 @classmethod 250 @classmethod
223 def _command_wrapper(cls, wrapper_option): 251 def _command_wrapper(cls, wrapper_option):
224 # Hook for injecting valgrind or other runtime instrumentation, 252 # Hook for injecting valgrind or other runtime instrumentation,
225 # used by e.g. tools/valgrind/valgrind_tests.py. 253 # used by e.g. tools/valgrind/valgrind_tests.py.
226 return shlex.split(wrapper_option) if wrapper_option else [] 254 return shlex.split(wrapper_option) if wrapper_option else []
227 255
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 self.decoded_content = None 574 self.decoded_content = None
547 self.malloc = None 575 self.malloc = None
548 self.js_heap = None 576 self.js_heap = None
549 self.stdin_path = None 577 self.stdin_path = None
550 578
551 def decode_content(self): 579 def decode_content(self):
552 if self.encoding == 'base64' and self.content is not None: 580 if self.encoding == 'base64' and self.content is not None:
553 self.decoded_content = base64.b64decode(self.content) 581 self.decoded_content = base64.b64decode(self.content)
554 else: 582 else:
555 self.decoded_content = self.content 583 self.decoded_content = self.content
OLDNEW
« 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