diff mbox series

[14/14] oeqa qemurunner.py: improve logging in run_serial()

Message ID 20230120144450.2913935-15-mikko.rapeli@linaro.org
State New
Headers show
Series oeqa runtime tests when qemu hangs | expand

Commit Message

Mikko Rapeli Jan. 20, 2023, 2:44 p.m. UTC
When serial communication times outs, write note also to bitbake
task output.

Then add a small sleep to collect more output to avoid
reading data one character at a time. This makes logs
much more readable.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 meta/lib/oeqa/utils/qemurunner.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 0e720ef5f0..b1c6ab8ce7 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -670,12 +670,15 @@  class QemuRunner:
             now = time.time()
             if now >= end:
                 data += "<<< run_serial(): command timed out after %d seconds without output >>>\r\n\r\n" % timeout
+                self.logger.debug("run_serial(): command timed out after %d seconds without output" % timeout)
                 break
             try:
                 sread, _, _ = select.select([self.server_socket],[],[], end - now)
             except InterruptedError:
                 continue
             if sread:
+                # try to avoid reading single character at a time, makes logs readable
+                time.sleep(0.1)
                 answer = self.server_socket.recv(1024)
                 if answer:
                     data += answer.decode('utf-8')