diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-06-26 18:23:38 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-28 21:50:51 -0700 |
commit | c4157673b909896884f594052ac2e19b0cfc2280 (patch) | |
tree | 91916870ac2819c1eb10a85175d70a6d018b5b1c /cts | |
parent | 75efd78a59486cbcfb111ef314bafca67bc8d993 (diff) | |
download | chrome-ec-c4157673b909896884f594052ac2e19b0cfc2280.tar.gz |
eCTS: Use proper methods to reset boards
This patch makes cts.py call reset_halt and resume instead of calling
send_openocd_commands directly.
BUG=none
BRANCH=none
TEST=Run util/run_ects.py.
Change-Id: I179fb73d41842b927fda81c153848887bb2dff57
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/553581
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'cts')
-rw-r--r-- | cts/common/board.py | 14 | ||||
-rwxr-xr-x | cts/cts.py | 12 |
2 files changed, 15 insertions, 11 deletions
diff --git a/cts/common/board.py b/cts/common/board.py index c301fac302..f2dce110d7 100644 --- a/cts/common/board.py +++ b/cts/common/board.py @@ -96,7 +96,7 @@ class Board(object): """Subclass should implement this.""" pass - def send_open_ocd_commands(self, commands): + def send_openocd_commands(self, commands): """Send a command to the board via openocd. Args: @@ -159,7 +159,7 @@ class Board(object): 'init', 'reset init', 'flash write_image erase %s %s' % (image_path, self.flash_offset)] - return self.send_open_ocd_commands(cmd) + return self.send_openocd_commands(cmd) def to_string(self): s = ('Type: Board\n' @@ -170,9 +170,13 @@ class Board(object): 'tty: ' + str(self.tty) + '\n') return s - def reset(self): + def reset_halt(self): """Reset then halt board.""" - return self.send_open_ocd_commands(['init', 'reset halt']) + return self.send_openocd_commands(['init', 'reset halt']) + + def resume(self): + """Resume halting board.""" + return self.send_openocd_commands(['init', 'resume']) def setup_tty(self): """Call this before calling read_tty for the first time. @@ -181,7 +185,7 @@ class Board(object): this function after serial numbers are setup """ self.get_serial() - self.reset() + self.reset_halt() self.identify_tty_port() tty = None diff --git a/cts/cts.py b/cts/cts.py index 7781a2d8fc..0ef862d996 100755 --- a/cts/cts.py +++ b/cts/cts.py @@ -320,16 +320,16 @@ class Cts(object): # 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...' - if not self.th.send_open_ocd_commands(['init', 'reset halt']): + if not self.th.reset_halt(): raise RuntimeError('Failed to halt TH') print 'Halting DUT...' - if not self.dut.send_open_ocd_commands(['init', 'reset halt']): + if not self.dut.reset_halt(): raise RuntimeError('Failed to halt DUT') print 'Resuming TH...' - if not self.th.send_open_ocd_commands(['init', 'resume']): + if not self.th.resume(): raise RuntimeError('Failed to resume TH') print 'Resuming DUT...' - if not self.dut.send_open_ocd_commands(['init', 'resume']): + if not self.dut.resume(): raise RuntimeError('Failed to resume DUT') time.sleep(MAX_SUITE_TIME_SEC) @@ -342,10 +342,10 @@ class Cts(object): self.th.close_tty() print 'Halting TH...' - if not self.th.send_open_ocd_commands(['init', 'reset halt']): + if not self.th.reset_halt(): raise RuntimeError('Failed to halt TH') print 'Halting DUT...' - if not self.dut.send_open_ocd_commands(['init', 'reset halt']): + if not self.dut.reset_halt(): raise RuntimeError('Failed to halt DUT') if not dut_output or not th_output: |