Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2348693004: [Android] Enable @RetryOnFailure. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 include_stack_symbols=False, 340 include_stack_symbols=False,
341 wipe_tombstones=True) 341 wipe_tombstones=True)
342 result.SetTombstones('\n'.join(resolved_tombstones)) 342 result.SetTombstones('\n'.join(resolved_tombstones))
343 return results 343 return results
344 344
345 #override 345 #override
346 def _ShouldRetry(self, test): 346 def _ShouldRetry(self, test):
347 if 'RetryOnFailure' in test.get('annotations', {}): 347 if 'RetryOnFailure' in test.get('annotations', {}):
348 return True 348 return True
349 349
350 # TODO(jbudorick): Remove this log message and switch the return value to 350 # TODO(jbudorick): Remove this log message once @RetryOnFailure has been
351 # False after tests have been annotated with @RetryOnFailure. 351 # enabled for a while. See crbug.com/619055 for more details.
352 # See crbug.com/619055 for more details. 352 logging.error('Default retries are being phased out. crbug.com/619055')
353 logging.warning('Default retries are being phased out. crbug.com/619055') 353 return False
354 return True
355 354
356 #override 355 #override
357 def _ShouldShard(self): 356 def _ShouldShard(self):
358 return True 357 return True
359 358
360 @classmethod 359 @classmethod
361 def _GetTimeoutScaleFromAnnotations(cls, annotations): 360 def _GetTimeoutScaleFromAnnotations(cls, annotations):
362 try: 361 try:
363 return int(annotations.get('TimeoutScale', 1)) 362 return int(annotations.get('TimeoutScale', 1))
364 except ValueError as e: 363 except ValueError as e:
365 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e)) 364 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e))
366 return 1 365 return 1
367 366
368 @classmethod 367 @classmethod
369 def _GetTimeoutFromAnnotations(cls, annotations, test_name): 368 def _GetTimeoutFromAnnotations(cls, annotations, test_name):
370 for k, v in TIMEOUT_ANNOTATIONS: 369 for k, v in TIMEOUT_ANNOTATIONS:
371 if k in annotations: 370 if k in annotations:
372 timeout = v 371 timeout = v
373 break 372 break
374 else: 373 else:
375 logging.warning('Using default 1 minute timeout for %s', test_name) 374 logging.warning('Using default 1 minute timeout for %s', test_name)
376 timeout = 60 375 timeout = 60
377 376
378 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 377 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
379 378
380 return timeout 379 return timeout
381 380
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698