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>
This commit is contained in:
Daisuke Nojiri
2017-06-21 13:28:31 -07:00
committed by chrome-bot
parent 181f960ad6
commit 79a5a035ea
2 changed files with 7 additions and 2 deletions

View File

@@ -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.

View File

@@ -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']):