Allow VtsFastbootVerification test devices over internet am: 84d7f79c91
Change-Id: I3e11f6dd15fe84f8e290567047b908c65bafa30c
diff --git a/testcases/host/fastboot/VtsFastbootVerification.py b/testcases/host/fastboot/VtsFastbootVerification.py
index d44fe20..18685ea 100644
--- a/testcases/host/fastboot/VtsFastbootVerification.py
+++ b/testcases/host/fastboot/VtsFastbootVerification.py
@@ -110,7 +110,7 @@
def tearDownClass(self):
"""Reboot to Android."""
- if self.dut.isBootloaderMode:
+ if self.dut.isBootloaderMode or self.dut.fastboot.isFastbootOverTcp(self.dut.serial):
self.dut.reboot()
self.dut.waitForBootCompletion()
diff --git a/utils/python/controllers/fastboot.py b/utils/python/controllers/fastboot.py
index 90d6d01..2d8313a 100644
--- a/utils/python/controllers/fastboot.py
+++ b/utils/python/controllers/fastboot.py
@@ -15,6 +15,8 @@
from subprocess import Popen, PIPE
+import socket
+
def exe_cmd(*cmds):
"""Executes commands in a new shell. Directing stderr to PIPE.
@@ -38,6 +40,15 @@
return out
return err
+def isFastbootOverTcp(serial):
+ token = serial.split(':')
+ if len(token) == 2:
+ try:
+ socket.inet_aton(token[0])
+ return True
+ except socket.error:
+ return False
+ return False
class FastbootError(Exception):
"""Raised when there is an error in fastboot operations."""
@@ -55,7 +66,10 @@
def __init__(self, serial=""):
self.serial = serial
if serial:
- self.fastboot_str = "fastboot -s {}".format(serial)
+ if isFastbootOverTcp(serial):
+ self.fastboot_str = "fastboot -s tcp:{}".format(serial[:serial.index(':')])
+ else:
+ self.fastboot_str = "fastboot -s {}".format(serial)
else:
self.fastboot_str = "fastboot"