mirror of https://github.com/ARMmbed/mbed-os.git
Modified DEV_NULL host test to take under consideration blocking serial port API
parent
2efe99a100
commit
97f526cc8c
|
@ -20,22 +20,28 @@ from sys import stdout
|
||||||
|
|
||||||
class DevNullTest(DefaultTest):
|
class DevNullTest(DefaultTest):
|
||||||
def run(self):
|
def run(self):
|
||||||
c = self.mbed.serial_read(128)
|
|
||||||
if c is None:
|
|
||||||
self.print_result("ioerr_serial")
|
|
||||||
return
|
|
||||||
# Data from serial received correctly
|
|
||||||
print "Received %d bytes:"% len(c)
|
|
||||||
print c
|
|
||||||
stdout.flush()
|
|
||||||
# Check for expected and unexpected prints in Mbed output
|
|
||||||
result = True
|
result = True
|
||||||
if "re-routing stdout to /null" not in c:
|
str = ''
|
||||||
result = False
|
for i in range(3):
|
||||||
if "printf redirected to /null" in c:
|
c = self.mbed.serial_read(128)
|
||||||
result = False
|
if c is None:
|
||||||
if "{failure}" in c:
|
self.print_result("ioerr_serial")
|
||||||
result = False
|
return
|
||||||
|
else:
|
||||||
|
str += c
|
||||||
|
# Check for expected and unexpected prints in Mbed output
|
||||||
|
if "re-routing stdout to /null" not in str:
|
||||||
|
result = False
|
||||||
|
if "printf redirected to /null" in str:
|
||||||
|
result = False
|
||||||
|
if "{failure}" in str:
|
||||||
|
result = False
|
||||||
|
if not result:
|
||||||
|
break
|
||||||
|
# Data from serial received correctly
|
||||||
|
print "Received %d bytes:"% len(str)
|
||||||
|
print str
|
||||||
|
stdout.flush()
|
||||||
if result:
|
if result:
|
||||||
self.print_result('success')
|
self.print_result('success')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue