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', | |
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 | |
299 logdog_upload_start = time.time() | |
jbudorick
2017/03/17 19:20:21
We will not want to include this timing/tracing lo
BigBossZhiling
2017/03/20 22:09:50
Done.
| |
295 with contextlib_ext.Optional( | 300 with contextlib_ext.Optional( |
296 logmon, self._test_instance.should_save_logcat): | 301 trace_event.trace('%s_%s' % (test_name, 'including_logdog_upload')), |
302 self._env.trace_output): | |
297 with contextlib_ext.Optional( | 303 with contextlib_ext.Optional( |
298 trace_event.trace(test_name), | 304 logmon, self._test_instance.should_save_logcat): |
299 self._env.trace_output): | 305 with contextlib_ext.Optional( |
300 output = device.StartInstrumentation( | 306 trace_event.trace(test_name), |
301 target, raw=True, extras=extras, timeout=timeout, retries=0) | 307 self._env.trace_output): |
308 test_start = time.time() | |
309 output = device.StartInstrumentation( | |
310 target, raw=True, extras=extras, timeout=timeout, retries=0) | |
311 test_end = time.time() | |
302 logcat_url = logmon.GetLogcatURL() | 312 logcat_url = logmon.GetLogcatURL() |
313 logdog_upload_end = time.time() | |
314 test_time = test_end - test_start | |
315 including_logdog_test_time = logdog_upload_end - logdog_upload_start | |
316 lag_in_logdog = including_logdog_test_time - test_time | |
317 logging.info('logdog_upload_affects (in second): %0.6f', lag_in_logdog) | |
303 finally: | 318 finally: |
304 device.RunShellCommand( | 319 device.RunShellCommand( |
305 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], | 320 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], |
306 check_return=True) | 321 check_return=True) |
307 duration_ms = time_ms() - start_ms | 322 duration_ms = time_ms() - start_ms |
308 if flags: | 323 if flags: |
309 self._flag_changers[str(device)].Restore() | 324 self._flag_changers[str(device)].Restore() |
310 if test_timeout_scale: | 325 if test_timeout_scale: |
311 valgrind_tools.SetChromeTimeoutScale( | 326 valgrind_tools.SetChromeTimeoutScale( |
312 device, self._test_instance.timeout_scale) | 327 device, self._test_instance.timeout_scale) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 timeout = v | 440 timeout = v |
426 break | 441 break |
427 else: | 442 else: |
428 logging.warning('Using default 1 minute timeout for %s', test_name) | 443 logging.warning('Using default 1 minute timeout for %s', test_name) |
429 timeout = 60 | 444 timeout = 60 |
430 | 445 |
431 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 446 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
432 | 447 |
433 return timeout | 448 return timeout |
434 | 449 |
OLD | NEW |