Chromium Code Reviews| 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 bf4bb6566297fad5a6221c67255c4eb217f713ae..79f7663da60057c3ee1e02cd72cd04f53c04c9f2 100644 |
| --- a/build/android/pylib/local/device/local_device_test_run.py |
| +++ b/build/android/pylib/local/device/local_device_test_run.py |
| @@ -113,8 +113,7 @@ class LocalDeviceTestRun(test_run.TestRun): |
| logging.info('Finished running tests on this device.') |
| tries = 0 |
| - results = base_test_result.TestRunResults() |
| - all_fail_results = {} |
| + results = [] |
| while tries < self._env.max_tries and tests: |
| logging.info('STARTING TRY #%d/%d', tries + 1, self._env.max_tries) |
| logging.info('Will run %d tests on %d devices: %s', |
| @@ -132,45 +131,37 @@ class LocalDeviceTestRun(test_run.TestRun): |
| self._env.parallel_devices.pMap( |
| run_tests_on_device, tests, try_results).pGet(None) |
| - for result in try_results.GetAll(): |
| - if result.GetType() in (base_test_result.ResultType.PASS, |
| - base_test_result.ResultType.SKIP): |
| - results.AddResult(result) |
| - else: |
| - all_fail_results[result.GetName()] = result |
| - |
| - results_names = set(r.GetName() for r in results.GetAll()) |
| - |
| - def has_test_result(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) for n in results_names) |
| - return name in results_names |
| - |
| - tests = [t for t in tests if not has_test_result(self._GetTestName(t))] |
| + results.append(try_results) |
|
mikecase (-- gone --)
2016/05/13 17:32:13
Should this be results.extend(try_results)? Im kin
jbudorick
2016/05/13 17:37:05
No, try_results is a single instance of base_test_
|
| tries += 1 |
| + tests = self._GetTestsToRetry(tests, try_results) |
| + |
| logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) |
| if tests: |
| logging.info('%d failed tests remain.', len(tests)) |
| else: |
| logging.info('All tests completed.') |
| - all_unknown_test_names = set(self._GetTestName(t) for t in tests) |
| - all_failed_test_names = set(all_fail_results.iterkeys()) |
| + return results |
| - unknown_tests = all_unknown_test_names.difference(all_failed_test_names) |
| - failed_tests = all_failed_test_names.intersection(all_unknown_test_names) |
| + def _GetTestsToRetry(self, tests, try_results): |
| + failed_test_names = set( |
| + r.GetName() for r in try_results.GetAll() |
| + if r.GetType() not in (base_test_result.ResultType.PASS, |
| + base_test_result.ResultType.SKIP)) |
| - if unknown_tests: |
| - results.AddResults( |
| - base_test_result.BaseTestResult( |
| - u, base_test_result.ResultType.UNKNOWN) |
| - for u in unknown_tests) |
| - if failed_tests: |
| - results.AddResults(all_fail_results[f] for f in failed_tests) |
| + all_test_names = set(r.GetName() for r in try_results.GetAll()) |
| - return results |
| + def has_test_result(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) for n in all_test_names) |
| + return name in all_test_names |
| + |
| + unknown_test_names = set( |
| + t for t in tests if not has_test_result(self._GetTestName(t))) |
| + |
| + return failed_test_names.union(unknown_test_names) |
| def GetTool(self, device): |
| if not str(device) in self._tools: |