| 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..11374bbf45025bcf72d8e84ef3bf7b688dfdd7de 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):
|
| @@ -235,16 +239,18 @@ def _RunAllTests(runners, test_collection_factory, num_retries, timeout=None,
|
| logging.warning('Running tests with %s test runners.' % (len(runners)))
|
| results = []
|
| exit_code = 0
|
| + run_results = base_test_result.TestRunResults()
|
| watcher = watchdog_timer.WatchdogTimer(timeout)
|
| + test_collections = [test_collection_factory() for _ in runners]
|
|
|
| - workers = reraiser_thread.ReraiserThreadGroup(
|
| - [reraiser_thread.ReraiserThread(
|
| + threads = [
|
| + 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])
|
| - run_results = base_test_result.TestRunResults()
|
| + for r, tc in zip(runners, test_collections)]
|
| +
|
| + workers = reraiser_thread.ReraiserThreadGroup(threads)
|
| workers.StartAll()
|
|
|
| # Catch DeviceUnresponsiveErrors and set a warning exit code
|
| @@ -254,6 +260,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():
|
|
|