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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 for l in output: | 324 for l in output: |
325 logging.debug(' %s', l) | 325 logging.debug(' %s', l) |
326 if self._test_instance.coverage_directory: | 326 if self._test_instance.coverage_directory: |
327 device.PullFile(coverage_directory, | 327 device.PullFile(coverage_directory, |
328 self._test_instance.coverage_directory) | 328 self._test_instance.coverage_directory) |
329 device.RunShellCommand('rm -f %s' % os.path.join(coverage_directory, | 329 device.RunShellCommand('rm -f %s' % os.path.join(coverage_directory, |
330 '*')) | 330 '*')) |
331 return results | 331 return results |
332 | 332 |
333 #override | 333 #override |
| 334 def _ShouldRetry(self, test): |
| 335 if 'RetryOnFailure' in test.get('annotations', {}): |
| 336 return True |
| 337 |
| 338 # TODO(jbudorick): Remove this log message and switch the return value to |
| 339 # False after tests have been annotated with @RetryOnFailure. |
| 340 # See crbug.com/619055 for more details. |
| 341 logging.warning('Default retries are being phased out. crbug.com/619055') |
| 342 return True |
| 343 |
| 344 #override |
334 def _ShouldShard(self): | 345 def _ShouldShard(self): |
335 return True | 346 return True |
336 | 347 |
337 @classmethod | 348 @classmethod |
338 def _GetTimeoutScaleFromAnnotations(cls, annotations): | 349 def _GetTimeoutScaleFromAnnotations(cls, annotations): |
339 try: | 350 try: |
340 return int(annotations.get('TimeoutScale', 1)) | 351 return int(annotations.get('TimeoutScale', 1)) |
341 except ValueError as e: | 352 except ValueError as e: |
342 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e)) | 353 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e)) |
343 return 1 | 354 return 1 |
344 | 355 |
345 @classmethod | 356 @classmethod |
346 def _GetTimeoutFromAnnotations(cls, annotations, test_name): | 357 def _GetTimeoutFromAnnotations(cls, annotations, test_name): |
347 for k, v in TIMEOUT_ANNOTATIONS: | 358 for k, v in TIMEOUT_ANNOTATIONS: |
348 if k in annotations: | 359 if k in annotations: |
349 timeout = v | 360 timeout = v |
350 break | 361 break |
351 else: | 362 else: |
352 logging.warning('Using default 1 minute timeout for %s', test_name) | 363 logging.warning('Using default 1 minute timeout for %s', test_name) |
353 timeout = 60 | 364 timeout = 60 |
354 | 365 |
355 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 366 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
356 | 367 |
357 return timeout | 368 return timeout |
358 | 369 |
OLD | NEW |