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

Unified Diff: build/android/pylib/base/test_dispatcher.py

Issue 23440009: [android] Fail if all devices drop offline while running tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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/base/test_dispatcher_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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():
« no previous file with comments | « no previous file | build/android/pylib/base/test_dispatcher_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698