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

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: Add README.txt describing harness-tests/wpt dir purpose. 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 | « third_party/WebKit/LayoutTests/harness-tests/wpt/console_logging-expected.txt ('k') | 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
qyearsley 2017/02/17 18:53:38 Nit: capitalize comment
Dan Elphick 2017/02/20 16:26:22 Done.
211 # designed for it do not fail when console messages appear in a
212 # non-deterministic order.
213 if any(dir in driver_input.test_name for dir in self.FILTER_CONSOLE_DIRS ):
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'
qyearsley 2017/02/17 18:53:38 Note that if there's no newline at the end of the
Dan Elphick 2017/02/20 16:26:22 I hadn't considered that, but it's more readable t
233 if line.startswith('CONSOLE'):
234 console_output += line
235 else:
236 new_out += line
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
228 HTTP_DIR = "http/tests/" 256 HTTP_DIR = "http/tests/"
229 HTTP_LOCAL_DIR = "http/tests/local/" 257 HTTP_LOCAL_DIR = "http/tests/local/"
230 WPT_DIR = "external/wpt/" 258 WPT_DIR = "external/wpt/"
259 FILTER_CONSOLE_DIRS = [
260 WPT_DIR,
261 'harness-tests/wpt',
262 ]
263
231 264
232 def is_http_test(self, test_name): 265 def is_http_test(self, test_name):
233 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith( self.HTTP_LOCAL_DIR) 266 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith( self.HTTP_LOCAL_DIR)
234 267
235 def _get_http_host_and_ports_for_test(self, test_name): 268 def _get_http_host_and_ports_for_test(self, test_name):
236 if self._port.should_use_wptserve(test_name): 269 if self._port.should_use_wptserve(test_name):
237 # TODO(burnik): Read from config or args. 270 # TODO(burnik): Read from config or args.
238 return ("web-platform.test", 8001, 8444) 271 return ("web-platform.test", 8001, 8444)
239 else: 272 else:
240 return ("127.0.0.1", 8000, 8443) 273 return ("127.0.0.1", 8000, 8443)
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 self.decoded_content = None 579 self.decoded_content = None
547 self.malloc = None 580 self.malloc = None
548 self.js_heap = None 581 self.js_heap = None
549 self.stdin_path = None 582 self.stdin_path = None
550 583
551 def decode_content(self): 584 def decode_content(self):
552 if self.encoding == 'base64' and self.content is not None: 585 if self.encoding == 'base64' and self.content is not None:
553 self.decoded_content = base64.b64decode(self.content) 586 self.decoded_content = base64.b64decode(self.content)
554 else: 587 else:
555 self.decoded_content = self.content 588 self.decoded_content = self.content
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/harness-tests/wpt/console_logging-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698