From 2df3125ca4c7a9b3b62176c862c5ba03e6030e72 Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Wed, 3 Sep 2014 15:01:19 +0100 Subject: [PATCH] Fixed missing STDOUT in Echo test Fixed missing opening and closing brackets in {{start}} --- libraries/tests/mbed/echo/main.cpp | 4 +++- workspace_tools/host_tests/echo.py | 9 ++++++++- workspace_tools/host_tests/stdio_auto.py | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libraries/tests/mbed/echo/main.cpp b/libraries/tests/mbed/echo/main.cpp index ddb25cd406..ead626ac13 100644 --- a/libraries/tests/mbed/echo/main.cpp +++ b/libraries/tests/mbed/echo/main.cpp @@ -22,11 +22,13 @@ int main() { Serial pc(TXPIN, RXPIN); pc.baud(115200); + + pc.puts("{{"); pc.puts(TEST_ENV_START); // Host test is expecting preamble + pc.puts("}}"); while (1) { pc.gets(buf, 256); - pc.printf("%s", buf); } } diff --git a/workspace_tools/host_tests/echo.py b/workspace_tools/host_tests/echo.py index 534807e44a..6771653cd6 100644 --- a/workspace_tools/host_tests/echo.py +++ b/workspace_tools/host_tests/echo.py @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. """ import uuid +from sys import stdout from host_test import Test @@ -28,12 +29,18 @@ class EchoTest(Test): # Let's wait for Mbed to print its readiness, usually "{{start}}" if self.mbed.serial_timeout(None) is None: self.print_result("ioerr_serial") - return + return c = self.mbed.serial_read(len('{{start}}')) if c is None: self.print_result("ioerr_serial") return + print c + stdout.flush() + + if self.mbed.serial_timeout(1) is None: + self.print_result("ioerr_serial") + return self.mbed.flush() self.notify("Starting the ECHO test") diff --git a/workspace_tools/host_tests/stdio_auto.py b/workspace_tools/host_tests/stdio_auto.py index 3b49d7d126..55e026ddea 100644 --- a/workspace_tools/host_tests/stdio_auto.py +++ b/workspace_tools/host_tests/stdio_auto.py @@ -37,6 +37,12 @@ class StdioTest(DefaultTest): if c is None: self.print_result("ioerr_serial") return + print c + stdout.flush() + + if self.mbed.serial_timeout(1) is None: + self.print_result("ioerr_serial") + return for i in range(1, 5): random_integer = random.randint(-99999, 99999) @@ -64,7 +70,7 @@ class StdioTest(DefaultTest): stdout.flush() break else: - print "Error: No IP and port information sent from server" + print "Error: No data from MUT sent" self.print_result('error') exit(-2)