From 97f526cc8cf5bc9662d11f23d2c43cb9fdb1d60c Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Thu, 11 Sep 2014 13:38:58 +0100 Subject: [PATCH] Modified DEV_NULL host test to take under consideration blocking serial port API --- workspace_tools/host_tests/dev_null_auto.py | 36 ++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/workspace_tools/host_tests/dev_null_auto.py b/workspace_tools/host_tests/dev_null_auto.py index c704bcba2e..cbcfdbb38a 100644 --- a/workspace_tools/host_tests/dev_null_auto.py +++ b/workspace_tools/host_tests/dev_null_auto.py @@ -20,22 +20,28 @@ from sys import stdout class DevNullTest(DefaultTest): 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 - if "re-routing stdout to /null" not in c: - result = False - if "printf redirected to /null" in c: - result = False - if "{failure}" in c: - result = False + str = '' + for i in range(3): + c = self.mbed.serial_read(128) + if c is None: + self.print_result("ioerr_serial") + 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: self.print_result('success') else: