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

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

Issue 1716863002: Raise exception when all devices fail to list tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_gtest_run.py
diff --git a/build/android/pylib/local/device/local_device_gtest_run.py b/build/android/pylib/local/device/local_device_gtest_run.py
index e740f564a23cdb8cb8c52aac216b99421a1d977d..121f351a1cfcd039cbce15cb84a13a3d375fe8e1 100644
--- a/build/android/pylib/local/device/local_device_gtest_run.py
+++ b/build/android/pylib/local/device/local_device_gtest_run.py
@@ -315,6 +315,14 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
# Query all devices in case one fails.
test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None)
+
+ # If all devices failed to list_tests, raise an exception.
+ check_one_device_failed = lambda result: result == None
+ check_both_devices_failed = lambda device_x_failed, device_y_failed: device_x_failed and device_y_failed
+ if reduce(check_both_devices_failed, map(check_one_device_failed, test_lists)):
mikecase (-- gone --) 2016/02/19 19:03:42 You could just do "if all(map(check_one_device_fai
BigBossZhiling 2016/02/19 22:13:47 Done.
+ # Now we know that all devices failed to do list_tests.
+ raise Exception('Failed to list tests on all devices')
mikecase (-- gone --) 2016/02/19 19:03:42 Look around in devil/android/device_errors.py for
BigBossZhiling 2016/02/19 22:13:47 Done.
+
# TODO(agrieve): Make this fail rather than return an empty list when
# all devices fail.
mikecase (-- gone --) 2016/02/19 19:03:42 nit: Remove this TODO.
return list(sorted(set().union(*[set(tl) for tl in test_lists if tl])))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698