Host test: wrapped mbed.serial.timeout into separate function to avoid traceback and send proper IO_SERIAL error from host test(s)

pull/445/head
Przemek Wirkus 2014-08-14 11:29:56 +01:00
parent a5bdd4a8bb
commit 278acbec5d
5 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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):