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_chromium:v', | |
jbudorick
2017/03/20 22:31:19
I think we can just take 'cr_*:v' rather than the
BigBossZhiling
2017/03/20 22:37:13
Done.
| |
39 'cr_ChromiumAndroidLinker:v', 'cr_LibraryLoader:v', | |
40 'cr_LinkerTest:v'] | |
38 | 41 |
39 # TODO(jbudorick): Make this private once the instrumentation test_runner is | 42 # TODO(jbudorick): Make this private once the instrumentation test_runner is |
40 # deprecated. | 43 # deprecated. |
41 def DidPackageCrashOnDevice(package_name, device): | 44 def DidPackageCrashOnDevice(package_name, device): |
42 # Dismiss any error dialogs. Limit the number in case we have an error | 45 # Dismiss any error dialogs. Limit the number in case we have an error |
43 # loop or we are failing to dismiss. | 46 # loop or we are failing to dismiss. |
44 try: | 47 try: |
45 for _ in xrange(10): | 48 for _ in xrange(10): |
46 package = device.DismissCrashDialogIfNeeded() | 49 package = device.DismissCrashDialogIfNeeded() |
47 if not package: | 50 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], | 287 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], |
285 check_return=True) | 288 check_return=True) |
286 time_ms = lambda: int(time.time() * 1e3) | 289 time_ms = lambda: int(time.time() * 1e3) |
287 start_ms = time_ms() | 290 start_ms = time_ms() |
288 | 291 |
289 stream_name = 'logcat_%s_%s_%s' % ( | 292 stream_name = 'logcat_%s_%s_%s' % ( |
290 test_name.replace('#', '.'), | 293 test_name.replace('#', '.'), |
291 time.strftime('%Y%m%dT%H%M%S', time.localtime()), | 294 time.strftime('%Y%m%dT%H%M%S', time.localtime()), |
292 device.serial) | 295 device.serial) |
293 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( | 296 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( |
294 device.adb, stream_name) | 297 device.adb, stream_name, filter_specs=LOGCAT_FILTERS) |
298 | |
295 with contextlib_ext.Optional( | 299 with contextlib_ext.Optional( |
296 logmon, self._test_instance.should_save_logcat): | 300 logmon, self._test_instance.should_save_logcat): |
297 with contextlib_ext.Optional( | 301 with contextlib_ext.Optional( |
298 trace_event.trace(test_name), | 302 trace_event.trace(test_name), |
299 self._env.trace_output): | 303 self._env.trace_output): |
300 output = device.StartInstrumentation( | 304 output = device.StartInstrumentation( |
301 target, raw=True, extras=extras, timeout=timeout, retries=0) | 305 target, raw=True, extras=extras, timeout=timeout, retries=0) |
302 logcat_url = logmon.GetLogcatURL() | 306 logcat_url = logmon.GetLogcatURL() |
303 finally: | 307 finally: |
304 device.RunShellCommand( | 308 device.RunShellCommand( |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 timeout = v | 429 timeout = v |
426 break | 430 break |
427 else: | 431 else: |
428 logging.warning('Using default 1 minute timeout for %s', test_name) | 432 logging.warning('Using default 1 minute timeout for %s', test_name) |
429 timeout = 60 | 433 timeout = 60 |
430 | 434 |
431 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 435 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
432 | 436 |
433 return timeout | 437 return timeout |
434 | 438 |
OLD | NEW |