| 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 |
| 11 from devil.android import device_errors | 11 from devil.android import device_errors |
| 12 from devil.android import flag_changer | 12 from devil.android import flag_changer |
| 13 from devil.utils import reraiser_thread | 13 from devil.utils import reraiser_thread |
| 14 from pylib import valgrind_tools | 14 from pylib import valgrind_tools |
| 15 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
| 16 from pylib.local.device import local_device_environment | 16 from pylib.local.device import local_device_environment |
| 17 from pylib.local.device import local_device_test_run | 17 from pylib.local.device import local_device_test_run |
| 18 import tombstones | 18 |
| 19 | 19 |
| 20 TIMEOUT_ANNOTATIONS = [ | 20 TIMEOUT_ANNOTATIONS = [ |
| 21 ('Manual', 10 * 60 * 60), | 21 ('Manual', 10 * 60 * 60), |
| 22 ('IntegrationTest', 30 * 60), | 22 ('IntegrationTest', 30 * 60), |
| 23 ('External', 10 * 60), | 23 ('External', 10 * 60), |
| 24 ('EnormousTest', 10 * 60), | 24 ('EnormousTest', 10 * 60), |
| 25 ('LargeTest', 5 * 60), | 25 ('LargeTest', 5 * 60), |
| 26 ('MediumTest', 3 * 60), | 26 ('MediumTest', 3 * 60), |
| 27 ('SmallTest', 1 * 60), | 27 ('SmallTest', 1 * 60), |
| 28 ] | 28 ] |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 valgrind_tools.SetChromeTimeoutScale( | 137 valgrind_tools.SetChromeTimeoutScale( |
| 138 dev, self._test_instance.timeout_scale) | 138 dev, self._test_instance.timeout_scale) |
| 139 | 139 |
| 140 steps = (install_apk, push_test_data, create_flag_changer) | 140 steps = (install_apk, push_test_data, create_flag_changer) |
| 141 if self._env.concurrent_adb: | 141 if self._env.concurrent_adb: |
| 142 reraiser_thread.RunAsync(steps) | 142 reraiser_thread.RunAsync(steps) |
| 143 else: | 143 else: |
| 144 for step in steps: | 144 for step in steps: |
| 145 step() | 145 step() |
| 146 if self._test_instance.store_tombstones: | |
| 147 tombstones.ClearAllTombstones(dev) | |
| 148 | 146 |
| 149 self._env.parallel_devices.pMap( | 147 self._env.parallel_devices.pMap( |
| 150 individual_device_set_up, | 148 individual_device_set_up, |
| 151 self._test_instance.GetDataDependencies()) | 149 self._test_instance.GetDataDependencies()) |
| 152 | 150 |
| 153 def TearDown(self): | 151 def TearDown(self): |
| 154 @local_device_environment.handle_shard_failures_with( | 152 @local_device_environment.handle_shard_failures_with( |
| 155 self._env.BlacklistDevice) | 153 self._env.BlacklistDevice) |
| 156 def individual_device_tear_down(dev): | 154 def individual_device_tear_down(dev): |
| 157 if str(dev) in self._flag_changers: | 155 if str(dev) in self._flag_changers: |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 322 |
| 325 else: | 323 else: |
| 326 logging.debug('raw output from %s:', test_display_name) | 324 logging.debug('raw output from %s:', test_display_name) |
| 327 for l in output: | 325 for l in output: |
| 328 logging.debug(' %s', l) | 326 logging.debug(' %s', l) |
| 329 if self._test_instance.coverage_directory: | 327 if self._test_instance.coverage_directory: |
| 330 device.PullFile(coverage_directory, | 328 device.PullFile(coverage_directory, |
| 331 self._test_instance.coverage_directory) | 329 self._test_instance.coverage_directory) |
| 332 device.RunShellCommand('rm -f %s' % os.path.join(coverage_directory, | 330 device.RunShellCommand('rm -f %s' % os.path.join(coverage_directory, |
| 333 '*')) | 331 '*')) |
| 334 if self._test_instance.store_tombstones: | |
| 335 for result in results: | |
| 336 if result.GetType() == base_test_result.ResultType.CRASH: | |
| 337 resolved_tombstones = tombstones.ResolveTombstones( | |
| 338 device, | |
| 339 resolve_all_tombstones=True, | |
| 340 include_stack_symbols=False, | |
| 341 wipe_tombstones=True) | |
| 342 result.SetTombstones('\n'.join(resolved_tombstones)) | |
| 343 return results | 332 return results |
| 344 | 333 |
| 345 #override | 334 #override |
| 346 def _ShouldRetry(self, test): | 335 def _ShouldRetry(self, test): |
| 347 if 'RetryOnFailure' in test.get('annotations', {}): | 336 if 'RetryOnFailure' in test.get('annotations', {}): |
| 348 return True | 337 return True |
| 349 | 338 |
| 350 # TODO(jbudorick): Remove this log message and switch the return value to | 339 # TODO(jbudorick): Remove this log message and switch the return value to |
| 351 # False after tests have been annotated with @RetryOnFailure. | 340 # False after tests have been annotated with @RetryOnFailure. |
| 352 # See crbug.com/619055 for more details. | 341 # See crbug.com/619055 for more details. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 372 timeout = v | 361 timeout = v |
| 373 break | 362 break |
| 374 else: | 363 else: |
| 375 logging.warning('Using default 1 minute timeout for %s', test_name) | 364 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 376 timeout = 60 | 365 timeout = 60 |
| 377 | 366 |
| 378 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 367 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 379 | 368 |
| 380 return timeout | 369 return timeout |
| 381 | 370 |
| OLD | NEW |