Skip to content

Commit f1db89e

Browse files
committed
Added new error codes to test suite: IOERR_SERIAL, IOERR_DISK, IOERR_TIMEOUT, IOERR_COPY. Not all of them are yet handled but naming convention added for further implementations.
1 parent 054d33a commit f1db89e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

workspace_tools/singletest.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,29 @@ def stop(self):
136136
class SingleTestRunner(object):
137137
""" Object wrapper for single test run which may involve multiple MUTs."""
138138

139-
re_detect_testcase_result = None
139+
RE_DETECT_TESTCASE_RESULT = None
140140
TEST_RESULT_OK = "OK"
141141
TEST_RESULT_FAIL = "FAIL"
142142
TEST_RESULT_ERROR = "ERROR"
143143
TEST_RESULT_UNDEF = "UNDEF"
144144
TEST_RESULT_IOERR_COPY = "IOERR_COPY"
145145
TEST_RESULT_IOERR_DISK = "IOERR_DISK"
146+
TEST_RESULT_IOERR_SERIAL = "IOERR_SERIAL"
146147
TEST_RESULT_TIMEOUT = "TIMEOUT"
147148

148149
# mbed test suite -> SingleTestRunner
149150
TEST_RESULT_MAPPING = {"success" : TEST_RESULT_OK,
150151
"failure" : TEST_RESULT_FAIL,
151-
"error" : TEST_RESULT_ERROR,
152-
"end" : TEST_RESULT_UNDEF}
152+
"error" : TEST_RESULT_ERROR,
153+
"ioerr_copy" : TEST_RESULT_IOERR_COPY,
154+
"ioerr_disk" : TEST_RESULT_IOERR_DISK,
155+
"ioerr_serial" : TEST_RESULT_IOERR_SERIAL,
156+
"timeout" : TEST_RESULT_TIMEOUT,
157+
"end" : TEST_RESULT_UNDEF}
153158

154159
def __init__(self):
155160
pattern = "\\{(" + "|".join(self.TEST_RESULT_MAPPING.keys()) + ")\\}"
156-
self.re_detect_testcase_result = re.compile(pattern)
161+
self.RE_DETECT_TESTCASE_RESULT = re.compile(pattern)
157162

158163
def file_copy_method_selector(self, image_path, disk, copy_method):
159164
""" Copy file depending on method you want to use """
@@ -313,7 +318,7 @@ def run_host_test(self, name, disk, port, duration, verbose=False, extra_serial=
313318
# Parse test 'output' data
314319
result = self.TEST_RESULT_UNDEF
315320
for line in "".join(output).splitlines():
316-
search_result = self.re_detect_testcase_result.search(line)
321+
search_result = self.RE_DETECT_TESTCASE_RESULT.search(line)
317322
if search_result and len(search_result.groups()):
318323
result = self.TEST_RESULT_MAPPING[search_result.groups(0)[0]]
319324
break

0 commit comments

Comments
 (0)