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

Unified Diff: build/android/pylib/local/device/local_device_test_run.py

Issue 2099323002: [Android] Prepare the test runner for @RetryOnFailure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/local/device/local_device_instrumentation_test_run.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_test_run.py
diff --git a/build/android/pylib/local/device/local_device_test_run.py b/build/android/pylib/local/device/local_device_test_run.py
index 81b855b3830ca28d893f66217347431fd4abcaf3..bcdb012bc13090937641fb1a4196421ef01f32a9 100644
--- a/build/android/pylib/local/device/local_device_test_run.py
+++ b/build/android/pylib/local/device/local_device_test_run.py
@@ -176,7 +176,7 @@ class LocalDeviceTestRun(test_run.TestRun):
def _GetTestsToRetry(self, tests, try_results):
- def is_failure(test_result):
+ def is_failure_result(test_result):
return (
test_result is None
or test_result.GetType() not in (
@@ -185,15 +185,17 @@ class LocalDeviceTestRun(test_run.TestRun):
all_test_results = {r.GetName(): r for r in try_results.GetAll()}
- def should_retry(name):
+ def test_failed(name):
# When specifying a test filter, names can contain trailing wildcards.
# See local_device_gtest_run._ExtractTestsFromFilter()
if name.endswith('*'):
- return any(fnmatch.fnmatch(n, name) and is_failure(t)
+ return any(fnmatch.fnmatch(n, name) and is_failure_result(t)
for n, t in all_test_results.iteritems())
- return is_failure(all_test_results.get(name))
+ return is_failure_result(all_test_results.get(name))
- return [t for t in tests if should_retry(self._GetUniqueTestName(t))]
+ failed_tests = (t for t in tests if test_failed(self._GetUniqueTestName(t)))
+
+ return [t for t in failed_tests if self._ShouldRetry(t)]
def GetTool(self, device):
if not str(device) in self._tools:
@@ -204,10 +206,14 @@ class LocalDeviceTestRun(test_run.TestRun):
def _CreateShards(self, tests):
raise NotImplementedError
- # pylint: disable=no-self-use
def _GetUniqueTestName(self, test):
+ # pylint: disable=no-self-use
return test
+ def _ShouldRetry(self, test):
+ # pylint: disable=no-self-use,unused-argument
+ return True
+
def _GetTests(self):
raise NotImplementedError
« no previous file with comments | « build/android/pylib/local/device/local_device_instrumentation_test_run.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698