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):
|
||||
def run(self):
|
||||
result = True
|
||||
str = ''
|
||||
for i in range(3):
|
||||
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()
|
||||
else:
|
||||
str += c
|
||||
# Check for expected and unexpected prints in Mbed output
|
||||
result = True
|
||||
if "re-routing stdout to /null" not in c:
|
||||
if "re-routing stdout to /null" not in str:
|
||||
result = False
|
||||
if "printf redirected to /null" in c:
|
||||
if "printf redirected to /null" in str:
|
||||
result = False
|
||||
if "{failure}" in c:
|
||||
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:
|
||||
self.print_result('success')
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue