eCTS: Pause a few seconds before flushing tty

After a board is reset for setting up a tty port, the host should
wait for a few seconds before flushing the port as the board may
still be booting. This should prevent output from the previous boot
from creeping into a test run.

BUG=none
BRANCH=none
TEST=cts.py -m gpio, interrupt, timer

Change-Id: I1fb567a3a8ddcfff61865b6db3866c56be386c4a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/408759
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Daisuke Nojiri
2016-11-08 16:14:47 -08:00
committed by chrome-bot
parent f44bc36982
commit d57ca41577

View File

@@ -121,19 +121,6 @@ class Cts(object):
self.th.get_serial()
self.dut.get_serial()
def reset_boards(self):
"""Resets the boards and allows them to run tests
Due to current (7/27/16) version of sync function,
both boards must be rest and halted, with the th
resuming first, in order for the test suite to run
in sync
"""
self.identify_boards()
self.th.send_open_ocd_commands(['init', 'reset halt'])
self.dut.send_open_ocd_commands(['init', 'reset halt'])
self.th.send_open_ocd_commands(['init', 'resume'])
self.dut.send_open_ocd_commands(['init', 'resume'])
@staticmethod
def get_macro_args(filepath, macro):
"""Get list of args of a certain macro in a file when macro is used
@@ -317,11 +304,25 @@ class Cts(object):
self.dut.setup_tty()
self.th.setup_tty()
# Boards might be still writing to tty. Wait a few seconds before flashing.
time.sleep(3)
# clear buffers
self.dut.read_tty()
self.th.read_tty()
self.reset_boards()
# Resets the boards and allows them to run tests
# Due to current (7/27/16) version of sync function,
# both boards must be rest and halted, with the th
# resuming first, in order for the test suite to run in sync
print 'Halting TH...'
self.th.send_open_ocd_commands(['init', 'reset halt'])
print 'Resetting DUT...'
self.dut.send_open_ocd_commands(['init', 'reset halt'])
print 'Resuming TH...'
self.th.send_open_ocd_commands(['init', 'resume'])
print 'Resuming DUT...'
self.dut.send_open_ocd_commands(['init', 'resume'])
time.sleep(MAX_SUITE_TIME_SEC)