mirror of https://github.com/ARMmbed/mbed-os.git
Host test: wrapped mbed.serial.timeout into separate function to avoid traceback and send proper IO_SERIAL error from host test(s)
parent
a5bdd4a8bb
commit
278acbec5d
|
@ -29,7 +29,7 @@ class EchoTest(Test):
|
|||
TEST="longer serial test"
|
||||
check = True
|
||||
for i in range(1, 100):
|
||||
self.mbed.serial.write(TEST + "\n")
|
||||
self.mbed.serial_write(TEST + "\n")
|
||||
l = self.mbed.serial.readline().strip()
|
||||
if not l: continue
|
||||
|
||||
|
|
|
@ -124,12 +124,12 @@ class Mbed:
|
|||
def serial_write(self, write_buffer):
|
||||
""" Wraps self.mbed.serial object write method
|
||||
"""
|
||||
result = -1
|
||||
result = None
|
||||
if self.serial:
|
||||
try:
|
||||
result = self.serial.write(write_buffer)
|
||||
except:
|
||||
result = -1
|
||||
result = None
|
||||
return result
|
||||
|
||||
def safe_sendBreak(self, serial):
|
||||
|
|
|
@ -31,7 +31,7 @@ class StdioTest(DefaultTest):
|
|||
for i in range(1, 5):
|
||||
random_integer = random.randint(-10000, 10000)
|
||||
print "Generated number: " + str(random_integer)
|
||||
self.mbed.serial.write(str(random_integer) + "\n")
|
||||
self.mbed.serial_write(str(random_integer) + "\n")
|
||||
serial_stdio_msg = ""
|
||||
|
||||
ip_msg_timeout = self.mbed.options.timeout
|
||||
|
|
|
@ -33,7 +33,7 @@ class TCPEchoClientTest(Test):
|
|||
self.mbed.reset()
|
||||
print "Sending server IP Address to target..."
|
||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||
self.mbed.serial.write(connection_str)
|
||||
self.mbed.serial_write(connection_str)
|
||||
|
||||
|
||||
class TCPEchoClient_Handler(BaseRequestHandler):
|
||||
|
|
|
@ -32,7 +32,7 @@ class UDPEchoClientTest(Test):
|
|||
self.mbed.reset()
|
||||
print "Sending server IP Address to target..."
|
||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||
self.mbed.serial.write(connection_str)
|
||||
self.mbed.serial_write(connection_str)
|
||||
|
||||
|
||||
class UDPEchoClient_Handler(BaseRequestHandler):
|
||||
|
|
Loading…
Reference in New Issue