diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-06-20 18:09:50 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-23 00:51:19 -0700 |
commit | 181f960ad62e310b122895c538c1b1d5f65b8546 (patch) | |
tree | 8429c36ee6f97b951ab162e94401f2dac1c9a6c0 /cts | |
parent | 577e599f57825f184cb828e08d9b6cc1d3959a71 (diff) | |
download | chrome-ec-181f960ad62e310b122895c538c1b1d5f65b8546.tar.gz |
eCTS: Strip board serial string
If we don't strip a serial string read from a file, TH serial doesn't
match with the one read from lsusb. It causes TH to be recognized as
a DUT.
This patch also makes error messages more helpful when DUT is not found
or multiple DUTs are connected.
BUG=none
BRANCH=none
TEST=cts/cts.py -m meta, task
Change-Id: Ifcf96089b9620ef8809a7d2924dacf67d3af419c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/542019
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'cts')
-rw-r--r-- | cts/common/board.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cts/common/board.py b/cts/common/board.py index 7714179c41..090b3eb931 100644 --- a/cts/common/board.py +++ b/cts/common/board.py @@ -284,7 +284,8 @@ class TestHarness(Board): return # serial was already loaded try: with open(self.serial_path, mode='r') as ser_f: - self.hla_serial = ser_f.read() + serial = ser_f.read() + self.hla_serial = serial.strip() return except IOError: msg = ('Your TH board has not been identified.\n' @@ -357,9 +358,15 @@ class DeviceUnderTest(Board): # If len(dut) is 0 then your dut doesn't use an st-link device, so we # don't have to worry about its serial number - if len(dut) != 1: - msg = ('Your TH serial number is incorrect, or your have' - ' too many st-link devices attached.') + if not dut: + msg = ('Failed to find serial for DUT.\n' + 'Is ' + self.board + ' connected?') + raise RuntimeError(msg) + if len(dut) > 1: + msg = ('Found multiple DUTs.\n' + 'You can connect only one DUT at a time. This may be caused by\n' + 'an incorrect TH serial. Check if ' + self.th.serial_path + '\n' + 'contains a correct serial.') raise RuntimeError(msg) # Found your other st-link device serial! |