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

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2893063003: Include logcat created by StrictMode and test_runner_py. (Closed)
Patch Set: Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import posixpath 7 import posixpath
8 import re 8 import re
9 import tempfile 9 import tempfile
10 import time 10 import time
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TIMEOUT_ANNOTATIONS = [ 43 TIMEOUT_ANNOTATIONS = [
44 ('Manual', 10 * 60 * 60), 44 ('Manual', 10 * 60 * 60),
45 ('IntegrationTest', 30 * 60), 45 ('IntegrationTest', 30 * 60),
46 ('External', 10 * 60), 46 ('External', 10 * 60),
47 ('EnormousTest', 10 * 60), 47 ('EnormousTest', 10 * 60),
48 ('LargeTest', 5 * 60), 48 ('LargeTest', 5 * 60),
49 ('MediumTest', 3 * 60), 49 ('MediumTest', 3 * 60),
50 ('SmallTest', 1 * 60), 50 ('SmallTest', 1 * 60),
51 ] 51 ]
52 52
53 LOGCAT_FILTERS = ['*:e', 'chromium:v', 'cr_*:v', 'DEBUG:I'] 53 LOGCAT_FILTERS = ['*:e', 'chromium:v', 'cr_*:v', 'DEBUG:I',
54 'StrictMode:D', 'test_runner_py:I']
jbudorick 2017/05/21 19:10:29 nit: '%s:I' % _TAG instead of 'test_runner
BigBossZhiling 2017/05/22 07:07:36 Done.
54 55
55 EXTRA_SCREENSHOT_FILE = ( 56 EXTRA_SCREENSHOT_FILE = (
56 'org.chromium.base.test.ScreenshotOnFailureStatement.ScreenshotFile') 57 'org.chromium.base.test.ScreenshotOnFailureStatement.ScreenshotFile')
57 58
58 FEATURE_ANNOTATION = 'Feature' 59 FEATURE_ANNOTATION = 'Feature'
59 RENDER_TEST_FEATURE_ANNOTATION = 'RenderTest' 60 RENDER_TEST_FEATURE_ANNOTATION = 'RenderTest'
60 61
61 # This needs to be kept in sync with formatting in |RenderUtils.imageName| 62 # This needs to be kept in sync with formatting in |RenderUtils.imageName|
62 RE_RENDER_IMAGE_NAME = re.compile( 63 RE_RENDER_IMAGE_NAME = re.compile(
63 r'(?P<test_class>\w+)\.' 64 r'(?P<test_class>\w+)\.'
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 'render_test_output_dir') 349 'render_test_output_dir')
349 flags_to_add.append('--render-test-output-dir=%s' % 350 flags_to_add.append('--render-test-output-dir=%s' %
350 render_tests_device_output_dir) 351 render_tests_device_output_dir)
351 352
352 if flags_to_add or flags_to_remove: 353 if flags_to_add or flags_to_remove:
353 self._CreateFlagChangerIfNeeded(device) 354 self._CreateFlagChangerIfNeeded(device)
354 self._flag_changers[str(device)].PushFlags( 355 self._flag_changers[str(device)].PushFlags(
355 add=flags_to_add, remove=flags_to_remove) 356 add=flags_to_add, remove=flags_to_remove)
356 357
357 try: 358 try:
358 device.RunShellCommand( 359 device.RunShellCommand(
jbudorick 2017/05/21 19:10:29 You'll need to move this call and the END call ins
BigBossZhiling 2017/05/22 07:07:36 Do you mean logdog logcat monitor? logcat monitor
jbudorick 2017/05/22 13:14:05 Yeah, meant the LogdogLogcatMonitor below but was
BigBossZhiling 2017/05/22 21:11:03 Done.
359 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], 360 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name],
360 check_return=True) 361 check_return=True)
361 time_ms = lambda: int(time.time() * 1e3) 362 time_ms = lambda: int(time.time() * 1e3)
362 start_ms = time_ms() 363 start_ms = time_ms()
363 364
364 stream_name = 'logcat_%s_%s_%s' % ( 365 stream_name = 'logcat_%s_%s_%s' % (
365 test_name.replace('#', '.'), 366 test_name.replace('#', '.'),
366 time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime()), 367 time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime()),
367 device.serial) 368 device.serial)
368 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( 369 logmon = logdog_logcat_monitor.LogdogLogcatMonitor(
369 device.adb, stream_name, filter_specs=LOGCAT_FILTERS) 370 device.adb, stream_name, filter_specs=LOGCAT_FILTERS)
370 371
371 with contextlib_ext.Optional( 372 with contextlib_ext.Optional(
372 logmon, self._test_instance.should_save_logcat): 373 logmon, self._test_instance.should_save_logcat):
jbudorick 2017/05/22 13:14:05 i.e., that logging needs to be done within this co
BigBossZhiling 2017/05/22 21:11:03 Done.
373 with contextlib_ext.Optional( 374 with contextlib_ext.Optional(
374 trace_event.trace(test_name), 375 trace_event.trace(test_name),
375 self._env.trace_output): 376 self._env.trace_output):
376 output = device.StartInstrumentation( 377 output = device.StartInstrumentation(
377 target, raw=True, extras=extras, timeout=timeout, retries=0) 378 target, raw=True, extras=extras, timeout=timeout, retries=0)
378 logcat_url = logmon.GetLogcatURL() 379 logcat_url = logmon.GetLogcatURL()
379 finally: 380 finally:
380 device.RunShellCommand( 381 device.RunShellCommand(
381 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], 382 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name],
382 check_return=True) 383 check_return=True)
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 647 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
647 648
648 return timeout 649 return timeout
649 650
650 def _IsRenderTest(test): 651 def _IsRenderTest(test):
651 """Determines if a test or list of tests has a RenderTest amongst them.""" 652 """Determines if a test or list of tests has a RenderTest amongst them."""
652 if not isinstance(test, list): 653 if not isinstance(test, list):
653 test = [test] 654 test = [test]
654 return any([RENDER_TEST_FEATURE_ANNOTATION in t['annotations'].get( 655 return any([RENDER_TEST_FEATURE_ANNOTATION in t['annotations'].get(
655 FEATURE_ANNOTATION, {}).get('value', ()) for t in test]) 656 FEATURE_ANNOTATION, {}).get('value', ()) for t in test])
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