Skip to content

Commit 61b1d75

Browse files
committed
Added dynamic test printing
1 parent 4e3b149 commit 61b1d75

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

workspace_tools/host_tests/echo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ def __init__(self):
2626

2727
def test(self):
2828
# Let's wait for Mbed to print its readiness, usually "{{start}}"
29-
c = self.mbed.serial_read(16)
29+
if self.mbed.serial_timeout(None) is None:
30+
self.print_result("ioerr_serial")
31+
return
32+
33+
c = self.mbed.serial_read(len('{{start}}'))
3034
if c is None:
3135
self.print_result("ioerr_serial")
3236
return

workspace_tools/host_tests/stdio_auto.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def run(self):
2929
test_result = True
3030

3131
# Let's wait for Mbed to print its readiness, usually "{{start}}"
32-
c = self.mbed.serial_read(16)
32+
if self.mbed.serial_timeout(None) is None:
33+
self.print_result("ioerr_serial")
34+
return
35+
36+
c = self.mbed.serial_read(len('{{start}}'))
3337
if c is None:
3438
self.print_result("ioerr_serial")
3539
return

workspace_tools/test_api.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ def run_host_test(self, name, disk, port, duration, reset=None, reset_tout=None,
799799

800800
if verbose:
801801
print "Executing '" + " ".join(cmd) + "'"
802+
print "Test::Output::Start"
802803

803804
proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS)
804805
obs = ProcessObserver(proc)
@@ -813,7 +814,8 @@ def run_host_test(self, name, disk, port, duration, reset=None, reset_tout=None,
813814

814815
if c:
815816
output.append(c)
816-
sys.stdout.write(c)
817+
if verbose:
818+
sys.stdout.write(c)
817819
# Give the mbed under test a way to communicate the end of the test
818820
if c in ['\n', '\r']:
819821
if '{end}' in line:
@@ -829,16 +831,12 @@ def run_host_test(self, name, disk, port, duration, reset=None, reset_tout=None,
829831

830832
if c:
831833
output.append(c)
832-
sys.stdout.write(c)
834+
if verbose:
835+
sys.stdout.write(c)
836+
print "Test::Output::Finish"
833837
# Stop test process
834838
obs.stop()
835839

836-
# Handle verbose mode
837-
if verbose:
838-
print "Test::Output::Start"
839-
print "".join(output)
840-
print "Test::Output::Finish"
841-
842840
# Parse test 'output' data
843841
result = self.TEST_RESULT_TIMEOUT
844842
for line in "".join(output).splitlines():

0 commit comments

Comments
 (0)