Chromium Code Reviews| Index: build/android/test_runner.py |
| diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
| index c54ed28d324054eae3c5aee72aa1442d80bf1f36..7e7f9bb9113a67002191c1c8e0a6653a9e413d76 100755 |
| --- a/build/android/test_runner.py |
| +++ b/build/android/test_runner.py |
| @@ -16,7 +16,6 @@ import sys |
| import threading |
| import unittest |
| -from pylib import android_commands |
| from pylib import constants |
| from pylib import forwarder |
| from pylib import ports |
| @@ -25,6 +24,8 @@ from pylib.base import environment_factory |
| from pylib.base import test_dispatcher |
| from pylib.base import test_instance_factory |
| from pylib.base import test_run_factory |
| +from pylib.device import device_errors |
| +from pylib.device import device_utils |
| from pylib.gtest import gtest_config |
| from pylib.gtest import setup as gtest_setup |
| from pylib.gtest import test_options as gtest_test_options |
| @@ -867,18 +868,21 @@ def _GetAttachedDevices(test_device=None): |
| Returns: |
| A list of attached devices. |
| """ |
| - attached_devices = [] |
| - |
| - attached_devices = android_commands.GetAttachedDevices() |
| + attached_devices = device_utils.DeviceUtils.HealthyDevices() |
| if test_device: |
| - assert test_device in attached_devices, ( |
| - 'Did not find device %s among attached device. Attached devices: %s' |
| - % (test_device, ', '.join(attached_devices))) |
| - attached_devices = [test_device] |
| + for d in attached_devices: |
| + if test_device == d.adb.GetDeviceSerial(): |
| + attached_devices = [d] |
| + break |
| + else: |
| + raise device_errors.DeviceUnreachableError( |
| + 'Did not find device %s among attached device. Attached devices: %s' |
| + % (test_device, ', '.join(attached_devices))) |
|
perezju
2015/04/28 10:33:51
Hmm... Just a thought. By virtue of our definition
jbudorick
2015/04/28 13:44:59
I implemented __eq__ to support this behavior, but
perezju
2015/04/28 14:36:19
I think that should "just work". I did a bit of te
|
| - assert attached_devices, 'No devices attached.' |
| + if not attached_devices: |
| + raise device_errors.NoDevicesError() |
| - return sorted(attached_devices) |
| + return sorted(attached_devices, key=lambda d: d.adb.GetDeviceSerial()) |
|
perezju
2015/04/28 10:33:51
... and if we define __lt__, we also get |sorted|
jbudorick
2015/04/28 13:44:59
Done.
|
| def RunTestsCommand(args, parser): |