Changeset 127512 in webkit
- Timestamp:
- Sep 4, 2012 3:14:36 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r127507 r127512 1 2012-09-04 Xianzhu Wang <wangxianzhu@chromium.org> 2 3 [Chromium-Android] Include device serial number in ChromiumAndroidDriver log messages 4 https://bugs.webkit.org/show_bug.cgi?id=95770 5 6 Reviewed by Adam Barth. 7 8 * Scripts/webkitpy/layout_tests/port/chromium_android.py: 9 (ChromiumAndroidDriver.__init__): 10 (ChromiumAndroidDriver._log_error): Added to replace original _log.error(). 11 (ChromiumAndroidDriver._log_debug): Added to replace original _log.debug(). 12 (ChromiumAndroidDriver._abort): Added to replace original raise AssertionError(). 13 (ChromiumAndroidDriver._push_executable): 14 (ChromiumAndroidDriver._push_fonts): 15 (ChromiumAndroidDriver._push_test_resources): 16 (ChromiumAndroidDriver._run_adb_command): 17 (ChromiumAndroidDriver._get_last_stacktrace): 18 (ChromiumAndroidDriver._get_crash_log): 19 (ChromiumAndroidDriver._start): 20 (ChromiumAndroidDriver._start_once): 21 (ChromiumAndroidDriver._start_once.deadlock_detector): 22 * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py: 23 (ChromiumAndroidDriverTest.test_get_crash_log): 24 1 25 2012-09-04 Satish Sampath <satish@chromium.org> 2 26 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py
r127488 r127512 318 318 self._has_setup = False 319 319 self._original_governors = {} 320 self._adb_command = ['adb', '-s', port._get_device_serial(worker_number)] 320 self._device_serial = port._get_device_serial(worker_number) 321 self._adb_command = ['adb', '-s', self._device_serial] 321 322 322 323 def __del__(self): … … 347 348 # This is like what's done in ChromiumPort.setup_test_run but on the device. 348 349 self._run_adb_command(['shell', 'rm', '-r', DRT_APP_CACHE_DIR]) 350 351 def _log_error(self, message): 352 _log.error('[%s] %s' % (self._device_serial, message)) 353 354 def _log_debug(self, message): 355 _log.debug('[%s] %s' % (self._device_serial, message)) 356 357 def _abort(self, message): 358 raise AssertionError('[%s] %s' % (self._device_serial, message)) 349 359 350 360 def _push_executable(self): … … 356 366 'shell', 'cat %s 2>/dev/null || echo 0' % DEVICE_DRT_STAMP_PATH]))) 357 367 if device_stamp != host_stamp: 358 _log.debug('Pushing executable')368 self._log_debug('Pushing executable') 359 369 self._push_to_device(forwarder_host_path, DEVICE_FORWARDER_PATH) 360 370 self._run_adb_command(['uninstall', DRT_APP_PACKAGE]) 361 371 install_result = self._run_adb_command(['install', drt_host_path]) 362 372 if install_result.find('Success') == -1: 363 raise AssertionError('Failed to install %s onto device: %s' % (drt_host_path, install_result))373 self._abort('Failed to install %s onto device: %s' % (drt_host_path, install_result)) 364 374 self._push_to_device(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak') 365 375 self._push_to_device(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources') … … 374 384 def _push_fonts(self): 375 385 if not self._check_version(DEVICE_FONTS_DIR, FONT_FILES_VERSION): 376 _log.debug('Pushing fonts')386 self._log_debug('Pushing fonts') 377 387 path_to_ahem_font = self._port._build_path('AHEM____.TTF') 378 388 self._push_to_device(path_to_ahem_font, DEVICE_FONTS_DIR + 'AHEM____.TTF') … … 383 393 384 394 def _push_test_resources(self): 385 _log.debug('Pushing test resources')395 self._log_debug('Pushing test resources') 386 396 for resource in TEST_RESOURCES_TO_PUSH: 387 397 self._push_to_device(self._port.layout_tests_dir() + '/' + resource, DEVICE_LAYOUT_TESTS_DIR + resource) … … 410 420 411 421 def _run_adb_command(self, cmd, ignore_error=False): 412 _log.debug('Run adb command: ' + str(cmd))422 self._log_debug('Run adb command: ' + str(cmd)) 413 423 if ignore_error: 414 424 error_handler = self._port._executive.ignore_error … … 418 428 # Limit the length to avoid too verbose output of commands like 'adb logcat' and 'cat /data/tombstones/tombstone01' 419 429 # whose outputs are normally printed in later logs. 420 _log.debug('Run adb result: ' + result[:80])430 self._log_debug('Run adb result: ' + result[:80]) 421 431 return result 422 432 … … 435 445 tombstones = self._run_adb_command(['shell', 'ls', '-n', '/data/tombstones']) 436 446 if not tombstones or tombstones.startswith('/data/tombstones: No such file or directory'): 437 _log.error('DRT crashed, but no tombstone found!')447 self._log_error('DRT crashed, but no tombstone found!') 438 448 return '' 439 449 tombstones = tombstones.rstrip().split('\n') … … 480 490 if not stdout: 481 491 stdout = '' 482 stdout += '********* Logcat:\n' + self._get_logcat()492 stdout += '********* [%s] Logcat:\n%s' % (self._device_serial, self._get_logcat()) 483 493 if not stderr: 484 494 stderr = '' 485 stderr += '********* Tombstone file:\n' + self._get_last_stacktrace()495 stderr += '********* [%s] Tombstone file:\n%s' % (self._device_serial, self._get_last_stacktrace()) 486 496 return super(ChromiumAndroidDriver, self)._get_crash_log(stdout, stderr, newer_than) 487 497 … … 544 554 if self._start_once(pixel_tests, per_test_args): 545 555 return 546 _log.error('Failed to start DumpRenderTree application. Retries=%d. Log:%s' % (retries, self._get_logcat()))556 self._log_error('Failed to start DumpRenderTree application. Retries=%d. Log:%s' % (retries, self._get_logcat())) 547 557 self.stop() 548 558 time.sleep(2) 549 raise AssertionError('Failed to start DumpRenderTree application multiple times. Give up.')559 self._abort('Failed to start DumpRenderTree application multiple times. Give up.') 550 560 551 561 def _start_once(self, pixel_tests, per_test_args): 552 562 super(ChromiumAndroidDriver, self)._start(pixel_tests, per_test_args) 553 563 554 _log.debug('Starting forwarder')564 self._log_debug('Starting forwarder') 555 565 self._forwarder_process = self._port._server_process_constructor( 556 566 self._port, 'Forwarder', self._adb_command + ['shell', '%s -D %s' % (DEVICE_FORWARDER_PATH, FORWARD_PORTS)]) … … 561 571 start_result = self._run_adb_command(['shell', 'am', 'start', '-e', 'RunInSubThread', '-n', DRT_ACTIVITY_FULL_NAME]) 562 572 if start_result.find('Exception') != -1: 563 _log.error('Failed to start DumpRenderTree application. Exception:\n' + start_result)573 self._log_error('Failed to start DumpRenderTree application. Exception:\n' + start_result) 564 574 return False 565 575 … … 571 581 self._server_process.start() 572 582 self._read_prompt(deadline) 573 _log.debug('Interactive shell started')583 self._log_debug('Interactive shell started') 574 584 575 585 # Start a process to read from the stdout fifo of the DumpRenderTree app and print to stdout. 576 _log.debug('Redirecting stdout to ' + self._out_fifo_path)586 self._log_debug('Redirecting stdout to ' + self._out_fifo_path) 577 587 self._read_stdout_process = self._port._server_process_constructor( 578 588 self._port, 'ReadStdout', self._adb_command + ['shell', 'cat', self._out_fifo_path]) … … 580 590 581 591 # Start a process to read from the stderr fifo of the DumpRenderTree app and print to stdout. 582 _log.debug('Redirecting stderr to ' + self._err_fifo_path)592 self._log_debug('Redirecting stderr to ' + self._err_fifo_path) 583 593 self._read_stderr_process = self._port._server_process_constructor( 584 594 self._port, 'ReadStderr', self._adb_command + ['shell', 'cat', self._err_fifo_path]) 585 595 self._read_stderr_process.start() 586 596 587 _log.debug('Redirecting stdin to ' + self._in_fifo_path)597 self._log_debug('Redirecting stdin to ' + self._in_fifo_path) 588 598 self._server_process.write('cat >%s\n' % self._in_fifo_path) 589 599 … … 597 607 # main thread escape from the deadlocked state. After that, the main thread will 598 608 # treat this as a crash. 599 _log.warn('Deadlock detected. Processes killed.')609 self._log_error('Deadlock detected. Processes killed.') 600 610 for i in processes: 601 611 i.kill() -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
r124851 r127512 195 195 ('err bar\n' 196 196 'err baz\n' 197 '********* Tombstone file:\n'197 '********* [123456789ABCDEF0] Tombstone file:\n' 198 198 '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' 199 199 '/data/tombstones/tombstone_03\n' … … 202 202 u'STDOUT: out bar\n' 203 203 u'STDOUT: out baz\n' 204 u'STDOUT: ********* Logcat:\n'204 u'STDOUT: ********* [123456789ABCDEF0] Logcat:\n' 205 205 u'STDOUT: logcat contents\n' 206 206 u'STDERR: err bar\n' 207 207 u'STDERR: err baz\n' 208 u'STDERR: ********* Tombstone file:\n'208 u'STDERR: ********* [123456789ABCDEF0] Tombstone file:\n' 209 209 u'STDERR: -rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' 210 210 u'STDERR: /data/tombstones/tombstone_03\n' … … 214 214 self.driver._crashed_pid = None 215 215 self.assertEquals(self.driver._get_crash_log(None, None, newer_than=None), 216 ('********* Tombstone file:\n'216 ('********* [123456789ABCDEF0] Tombstone file:\n' 217 217 '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' 218 218 '/data/tombstones/tombstone_03\n' 219 219 'mock_contents\n', 220 220 u'crash log for <unknown process name> (pid <unknown>):\n' 221 u'STDOUT: ********* Logcat:\n'221 u'STDOUT: ********* [123456789ABCDEF0] Logcat:\n' 222 222 u'STDOUT: logcat contents\n' 223 u'STDERR: ********* Tombstone file:\n'223 u'STDERR: ********* [123456789ABCDEF0] Tombstone file:\n' 224 224 u'STDERR: -rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' 225 225 u'STDERR: /data/tombstones/tombstone_03\n'
Note: See TracChangeset
for help on using the changeset viewer.