diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2016-09-30 16:37:48 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-05 14:33:33 -0700 |
commit | a51cee362a5682e83ceee290ee878a13a4f00212 (patch) | |
tree | a2c0629bc7794c9c677006b4fcd84a64630cc60d | |
parent | e40fb3ef58a47d13418b2b6665026cf2ae5fd51e (diff) | |
download | chrome-ec-a51cee362a5682e83ceee290ee878a13a4f00212.tar.gz |
cts: Fail script when build or flash fails
This change makes cts.py fail when building or flashing a module for
DUT or TH fails.
BUG=none
BRANCH=none
TEST=Made cts.py fail by injecting build and flash error
Change-Id: Iec1e11f4a8c261eb4c989b118df218e86cb6f5f1
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393326
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | cts/common/board.py | 6 | ||||
-rwxr-xr-x | cts/cts.py | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/cts/common/board.py b/cts/common/board.py index 68d447fb51..7b09e2a9f1 100644 --- a/cts/common/board.py +++ b/cts/common/board.py @@ -93,7 +93,7 @@ class Board(object): for cmd in commands: args += ['-c', cmd] args += ['-c', 'shutdown'] - sp.call(args) + return sp.call(args) def build(self, module, ec_dir, debug=False): """Builds test suite module for board @@ -116,7 +116,7 @@ class Board(object): cmds.append('CTS_DEBUG=TRUE') print ' '.join(cmds) - sp.call(cmds) + return sp.call(cmds) def flash(self): """Flashes board with most recent build ec.bin""" @@ -125,7 +125,7 @@ class Board(object): 'init', 'reset init', 'flash write_image erase %s %s' % (image_path, self.flash_offset)] - self.send_open_ocd_commands(cmd) + return self.send_open_ocd_commands(cmd) def to_string(self): s = ('Type: Board\n' diff --git a/cts/cts.py b/cts/cts.py index 983b9751d2..2999e4d06f 100755 --- a/cts/cts.py +++ b/cts/cts.py @@ -94,14 +94,18 @@ class Cts(object): def build(self): """Build images for DUT and TH""" - self.dut.build(self.module, self.ec_dir, self.debug) - self.th.build(self.module, self.ec_dir, self.debug) + if self.dut.build(self.module, self.ec_dir, self.debug): + raise RuntimeError('Building module %s for DUT failed' % (self.module)) + if self.th.build(self.module, self.ec_dir, self.debug): + raise RuntimeError('Building module %s for TH failed' % (self.module)) def flash_boards(self): """Flashes th and dut boards with their most recently build ec.bin""" self.identify_boards() - self.th.flash() - self.dut.flash() + if self.th.flash(): + raise RuntimeError('Flashing TH failed') + if self.dut.flash(): + raise RuntimeError('Flashing DUT failed') def setup(self): """Setup boards""" |