[Android] Catch device exceptions from individual test shards.

Currently, if any one device fails but all tests pass on other devices,
the test run fails _even though_ all tests have succeeded. This patch
changes that -- if all tests pass, the test run will pass even if a
device fails. (If a test fails, or if all devices fail and not all tests
run, the test run will still fail.)

BUG=

Review URL: https://codereview.chromium.org/1262103002

Cr-Original-Commit-Position: refs/heads/master@{#340876}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1ca6eaede71ea9ac9f00a0c3bb55119c8ddf676e
This commit is contained in:
jbudorick 2015-07-29 06:15:34 -07:00 коммит произвёл Commit bot
Родитель d8fabf2ba1
Коммит f9f614482e
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -188,11 +188,14 @@ def _RunAllTests(runners, test_collection_factory, num_retries, timeout=None,
workers = reraiser_thread.ReraiserThreadGroup(threads)
workers.StartAll()
# Catch DeviceUnreachableErrors and set a warning exit code
try:
workers.JoinAll(watcher)
except device_errors.DeviceUnreachableError as e:
logging.error(e)
except device_errors.CommandFailedError:
logging.exception('Command failed on device.')
except device_errors.CommandFailedError:
logging.exception('Command timed out on device.')
except device_errors.DeviceUnreachableError:
logging.exception('Device became unreachable.')
if not all((len(tc) == 0 for tc in test_collections)):
logging.error('Only ran %d tests (all devices are likely offline).' %