Chromium Code Reviews| Index: build/android/pylib/base/test_dispatcher.py |
| diff --git a/build/android/pylib/base/test_dispatcher.py b/build/android/pylib/base/test_dispatcher.py |
| index 31fa0784dc94cd1249ee289eefc04672c8e7299b..39cc0817702a8092ec28305a1c0c790b84161219 100644 |
| --- a/build/android/pylib/base/test_dispatcher.py |
| +++ b/build/android/pylib/base/test_dispatcher.py |
| @@ -126,6 +126,10 @@ class _TestCollection(object): |
| break |
| yield r |
| + def __len__(self): |
| + """Return the number of tests currently in the collection.""" |
| + return len(self._tests) |
| + |
| def _RunTestsFromQueue(runner, test_collection, out_results, watcher, |
| num_retries, tag_results_with_device=False): |
| @@ -236,14 +240,14 @@ def _RunAllTests(runners, test_collection_factory, num_retries, timeout=None, |
| results = [] |
| exit_code = 0 |
| watcher = watchdog_timer.WatchdogTimer(timeout) |
| + test_collections = [test_collection_factory() for _ in runners] |
| workers = reraiser_thread.ReraiserThreadGroup( |
| [reraiser_thread.ReraiserThread( |
| _RunTestsFromQueue, |
| - [r, test_collection_factory(), results, watcher, num_retries, |
| - tag_results_with_device], |
| + [r, tc, results, watcher, num_retries, tag_results_with_device], |
| name=r.device[-4:]) |
| - for r in runners]) |
| + for r, tc in zip(runners, test_collections)]) |
|
frankf
2013/08/27 23:10:26
243-250 is unreadable. Use intermediate vars
craigdh
2013/08/28 17:58:17
Done.
|
| run_results = base_test_result.TestRunResults() |
| workers.StartAll() |
| @@ -254,6 +258,10 @@ def _RunAllTests(runners, test_collection_factory, num_retries, timeout=None, |
| logging.error(e) |
| exit_code = constants.WARNING_EXIT_CODE |
| + assert all([len(tc) == 0 for tc in test_collections]), ( |
| + 'Some tests were not run, all devices are likely offline (ran %d tests)' % |
| + len(run_results.GetAll())) |
| + |
| for r in results: |
| run_results.AddTestRunResults(r) |
| if not run_results.DidRunPass(): |