OLD | NEW |
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 time | 9 import time |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 TIMEOUT_ANNOTATIONS = [ | 28 TIMEOUT_ANNOTATIONS = [ |
29 ('Manual', 10 * 60 * 60), | 29 ('Manual', 10 * 60 * 60), |
30 ('IntegrationTest', 30 * 60), | 30 ('IntegrationTest', 30 * 60), |
31 ('External', 10 * 60), | 31 ('External', 10 * 60), |
32 ('EnormousTest', 10 * 60), | 32 ('EnormousTest', 10 * 60), |
33 ('LargeTest', 5 * 60), | 33 ('LargeTest', 5 * 60), |
34 ('MediumTest', 3 * 60), | 34 ('MediumTest', 3 * 60), |
35 ('SmallTest', 1 * 60), | 35 ('SmallTest', 1 * 60), |
36 ] | 36 ] |
37 | 37 |
| 38 LOGCAT_FILTERS = ['*:e', 'chromium:v', 'cr_*:v'] |
38 | 39 |
39 # TODO(jbudorick): Make this private once the instrumentation test_runner is | 40 # TODO(jbudorick): Make this private once the instrumentation test_runner is |
40 # deprecated. | 41 # deprecated. |
41 def DidPackageCrashOnDevice(package_name, device): | 42 def DidPackageCrashOnDevice(package_name, device): |
42 # Dismiss any error dialogs. Limit the number in case we have an error | 43 # Dismiss any error dialogs. Limit the number in case we have an error |
43 # loop or we are failing to dismiss. | 44 # loop or we are failing to dismiss. |
44 try: | 45 try: |
45 for _ in xrange(10): | 46 for _ in xrange(10): |
46 package = device.DismissCrashDialogIfNeeded() | 47 package = device.DismissCrashDialogIfNeeded() |
47 if not package: | 48 if not package: |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], | 285 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], |
285 check_return=True) | 286 check_return=True) |
286 time_ms = lambda: int(time.time() * 1e3) | 287 time_ms = lambda: int(time.time() * 1e3) |
287 start_ms = time_ms() | 288 start_ms = time_ms() |
288 | 289 |
289 stream_name = 'logcat_%s_%s_%s' % ( | 290 stream_name = 'logcat_%s_%s_%s' % ( |
290 test_name.replace('#', '.'), | 291 test_name.replace('#', '.'), |
291 time.strftime('%Y%m%dT%H%M%S', time.localtime()), | 292 time.strftime('%Y%m%dT%H%M%S', time.localtime()), |
292 device.serial) | 293 device.serial) |
293 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( | 294 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( |
294 device.adb, stream_name) | 295 device.adb, stream_name, filter_specs=LOGCAT_FILTERS) |
| 296 |
295 with contextlib_ext.Optional( | 297 with contextlib_ext.Optional( |
296 logmon, self._test_instance.should_save_logcat): | 298 logmon, self._test_instance.should_save_logcat): |
297 with contextlib_ext.Optional( | 299 with contextlib_ext.Optional( |
298 trace_event.trace(test_name), | 300 trace_event.trace(test_name), |
299 self._env.trace_output): | 301 self._env.trace_output): |
300 output = device.StartInstrumentation( | 302 output = device.StartInstrumentation( |
301 target, raw=True, extras=extras, timeout=timeout, retries=0) | 303 target, raw=True, extras=extras, timeout=timeout, retries=0) |
302 logcat_url = logmon.GetLogcatURL() | 304 logcat_url = logmon.GetLogcatURL() |
303 finally: | 305 finally: |
304 device.RunShellCommand( | 306 device.RunShellCommand( |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 timeout = v | 427 timeout = v |
426 break | 428 break |
427 else: | 429 else: |
428 logging.warning('Using default 1 minute timeout for %s', test_name) | 430 logging.warning('Using default 1 minute timeout for %s', test_name) |
429 timeout = 60 | 431 timeout = 60 |
430 | 432 |
431 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 433 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
432 | 434 |
433 return timeout | 435 return timeout |
434 | 436 |
OLD | NEW |