summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-06-21 13:28:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-23 00:51:19 -0700
commit79a5a035eafe3a9caa5184e0df73fb2de31f5b72 (patch)
tree4762975edd1d3e3911f23a3dcfd0609d886abdf9
parent181f960ad62e310b122895c538c1b1d5f65b8546 (diff)
downloadchrome-ec-79a5a035eafe3a9caa5184e0df73fb2de31f5b72.tar.gz
eCTS: Close tty
This patch makes cts.py close tty files explicitly. BUG=none BRANCH=none TEST=cts.py -m meta Change-Id: Ifebfdd9607a603075492a59b5fb588e3cbc4ab12 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/544106 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--cts/common/board.py7
-rwxr-xr-xcts/cts.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/cts/common/board.py b/cts/common/board.py
index 090b3eb931..e56ec47b2d 100644
--- a/cts/common/board.py
+++ b/cts/common/board.py
@@ -81,8 +81,7 @@ class Board(object):
List of serials
"""
usb_args = ['lsusb', '-v', '-d', '0x0483:0x374b']
- usb_process = sp.Popen(usb_args, stdout=sp.PIPE, shell=False)
- st_link_info = usb_process.communicate()[0]
+ st_link_info = sp.check_output(usb_args)
st_serials = []
for line in st_link_info.split('\n'):
if 'iSerial' not in line:
@@ -254,6 +253,10 @@ class Board(object):
fcntl.fcntl(fd, fcntl.F_SETFL, flag | os.O_NONBLOCK)
return fd
+ def close_tty(self):
+ """Close tty"""
+ os.close(self.tty)
+
class TestHarness(Board):
"""Subclass of Board representing a Test Harness.
diff --git a/cts/cts.py b/cts/cts.py
index ed0889698d..781abe4f07 100755
--- a/cts/cts.py
+++ b/cts/cts.py
@@ -335,8 +335,10 @@ class Cts(object):
print 'Reading DUT tty...'
dut_output, _ = self.dut.read_tty()
+ self.dut.close_tty()
print 'Reading TH tty...'
th_output, _ = self.th.read_tty()
+ self.th.close_tty()
print 'Halting TH...'
if not self.th.send_open_ocd_commands(['init', 'reset halt']):