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

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

Issue 2032253004: [Android] Ensure test names are unique during retry determination. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 4 years, 6 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 | « no previous file | build/android/pylib/local/device/local_device_test_run.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index 9b29ad6831bafdb3cf8cd37ce98265e024a59365..d5426bc3e66d52eddf8b6e595e102d5aa0550782 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -174,17 +174,20 @@ class LocalDeviceInstrumentationTestRun(
def _GetTests(self):
return self._test_instance.GetTests()
- #override
def _GetTestName(self, test):
+ # pylint: disable=no-self-use
return '%s#%s' % (test['class'], test['method'])
- def _GetTestNameForDisplay(self, test):
+ #override
+ def _GetUniqueTestName(self, test):
display_name = self._GetTestName(test)
- flags = test['flags']
- if flags.add:
- display_name = '%s with {%s}' % (display_name, ' '.join(flags.add))
- if flags.remove:
- display_name = '%s without {%s}' % (display_name, ' '.join(flags.remove))
+ if 'flags' in test:
+ flags = test['flags']
+ if flags.add:
+ display_name = '%s with {%s}' % (display_name, ' '.join(flags.add))
+ if flags.remove:
+ display_name = '%s without {%s}' % (
+ display_name, ' '.join(flags.remove))
return display_name
#override
@@ -226,13 +229,12 @@ class LocalDeviceInstrumentationTestRun(
timeout = sum(timeouts)
else:
test_name = self._GetTestName(test)
- test_display_name = test_name
+ test_display_name = self._GetUniqueTestName(test)
target = '%s/%s' % (
self._test_instance.test_package, self._test_instance.test_runner)
extras['class'] = test_name
if 'flags' in test:
flags = test['flags']
- test_display_name = self._GetTestNameForDisplay(test)
timeout = self._GetTimeoutFromAnnotations(
test['annotations'], test_display_name)
@@ -269,20 +271,20 @@ class LocalDeviceInstrumentationTestRun(
results = self._test_instance.GenerateTestResults(
result_code, result_bundle, statuses, start_ms, duration_ms)
+ # Update the result name if the test used flags.
+ if flags:
+ for r in results:
+ if r.GetName() == test_name:
+ r.SetName(test_display_name)
+
# Add UNKNOWN results for any missing tests.
iterable_test = test if isinstance(test, list) else [test]
- test_names = set(self._GetTestName(t) for t in iterable_test)
+ test_names = set(self._GetUniqueTestName(t) for t in iterable_test)
results_names = set(r.GetName() for r in results)
results.extend(
base_test_result.BaseTestResult(u, base_test_result.ResultType.UNKNOWN)
for u in test_names.difference(results_names))
- # Update the result name if the test used flags.
- if flags:
- for r in results:
- if r.GetName() == test_name:
- r.SetName(test_display_name)
-
# Update the result type if we detect a crash.
if DidPackageCrashOnDevice(self._test_instance.test_package, device):
for r in results:
« no previous file with comments | « no previous file | build/android/pylib/local/device/local_device_test_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698