If no device specified, get the first device found
This makes adb_reverse_forwarder.py a little more convenient to use. BUG=429859 Review URL: https://codereview.chromium.org/684383004 Cr-Original-Commit-Position: refs/heads/master@{#302548} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: a21bde9f055f3ed2cfc36f3022cabad0e44831b0
This commit is contained in:
Родитель
9ab5c27e4e
Коммит
5e04c0772a
|
@ -15,6 +15,7 @@ import optparse
|
|||
import sys
|
||||
import time
|
||||
|
||||
from pylib import android_commands
|
||||
from pylib import constants, forwarder
|
||||
from pylib.device import device_utils
|
||||
from pylib.utils import run_tests_helper
|
||||
|
@ -50,7 +51,19 @@ def main(argv):
|
|||
parser.error('Bad port number')
|
||||
sys.exit(1)
|
||||
|
||||
device = device_utils.DeviceUtils(options.device)
|
||||
devices = android_commands.GetAttachedDevices()
|
||||
|
||||
if options.device:
|
||||
if options.device not in devices:
|
||||
raise Exception('Error: %s not in attached devices %s' % (options.device,
|
||||
','.join(devices)))
|
||||
devices = [options.device]
|
||||
else:
|
||||
if not devices:
|
||||
raise Exception('Error: no connected devices')
|
||||
print("No device specified. Defaulting to " + devices[0])
|
||||
|
||||
device = device_utils.DeviceUtils(devices[0])
|
||||
constants.SetBuildType(options.build_type)
|
||||
try:
|
||||
forwarder.Forwarder.Map(port_pairs, device)
|
||||
|
|
Загрузка…
Ссылка в новой задаче