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 f91996512865bf2db7393382cb7f25d2510edf57..1a8e0c15831941da34840a3b379c3edd6c520e14 100644 |
--- a/build/android/pylib/base/test_dispatcher.py |
+++ b/build/android/pylib/base/test_dispatcher.py |
@@ -21,6 +21,7 @@ |
import logging |
import threading |
+from pylib import android_commands |
from pylib import constants |
from pylib.base import base_test_result |
from pylib.base import test_collection |
@@ -101,7 +102,7 @@ |
for test in collection: |
watcher.Reset() |
try: |
- if not runner.device.IsOnline(): |
+ if runner.device_serial not in android_commands.GetAttachedDevices(): |
# Device is unresponsive, stop handling tests on this device. |
msg = 'Device %s is unresponsive.' % runner.device_serial |
logging.warning(msg) |
@@ -149,7 +150,10 @@ |
runner = runner_factory(device, index) |
runner.SetUp() |
out_runners.append(runner) |
- except device_errors.DeviceUnreachableError as e: |
+ except (device_errors.DeviceUnreachableError, |
+ # TODO(jbudorick) Remove this once the underlying implementations |
+ # for the above are switched or wrapped. |
+ android_commands.errors.DeviceUnresponsiveError) as e: |
logging.warning('Failed to create shard for %s: [%s]', device, e) |
@@ -191,7 +195,10 @@ |
# Catch DeviceUnreachableErrors and set a warning exit code |
try: |
workers.JoinAll(watcher) |
- except device_errors.DeviceUnreachableError as e: |
+ except (device_errors.DeviceUnreachableError, |
+ # TODO(jbudorick) Remove this once the underlying implementations |
+ # for the above are switched or wrapped. |
+ android_commands.errors.DeviceUnresponsiveError) as e: |
logging.error(e) |
if not all((len(tc) == 0 for tc in test_collections)): |
@@ -229,7 +236,7 @@ |
threads = reraiser_thread.ReraiserThreadGroup( |
[reraiser_thread.ReraiserThread(_SetUp, |
[runner_factory, d, runners, counter], |
- name=str(d)[-4:]) |
+ name=d[-4:]) |
for d in devices]) |
threads.StartAll() |
threads.JoinAll(watchdog_timer.WatchdogTimer(timeout)) |
@@ -326,7 +333,10 @@ |
finally: |
try: |
_TearDownRunners(runners, setup_timeout) |
- except device_errors.DeviceUnreachableError as e: |
+ except (device_errors.DeviceUnreachableError, |
+ # TODO(jbudorick) Remove this once the underlying implementations |
+ # for the above are switched or wrapped. |
+ android_commands.errors.DeviceUnresponsiveError) as e: |
logging.warning('Device unresponsive during TearDown: [%s]', e) |
except Exception as e: |
logging.error('Unexpected exception caught during TearDown: %s' % str(e)) |