diff mbox series

[08/14] oeqa qemurunner: read more data at a time from serial and log all of it

Message ID 20230120144450.2913935-9-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
Use a short sleep to bundle serial console reads so that
we are not reading one character at a time which makes logs
more readable. Then write full serial log to debug output so that
boot issues can be investigated from do_testimage task logs.

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

Patch

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 49ec3858c7..97c049e224 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -202,7 +202,7 @@  class QemuRunner:
         qmp_file = "." + next(tempfile._get_candidate_names())
         qmp_param = ' -S -qmp unix:./%s,server,wait' % (qmp_file)
         qmp_port = self.tmpdir + "/" + qmp_file
-        # Create a second socket connection for debugging use, 
+        # Create a second socket connection for debugging use,
         # note this will NOT cause qemu to block waiting for the connection
         qmp_file2 = "." + next(tempfile._get_candidate_names())
         qmp_param += ' -qmp unix:./%s,server,nowait' % (qmp_file2)
@@ -468,8 +468,11 @@  class QemuRunner:
                     socklist.remove(self.server_socket)
                     self.logger.debug("Connection from %s:%s" % addr)
                 else:
+                    # try to avoid reading single character at a time, makes logs readable
+                    time.sleep(0.1)
                     data = data + sock.recv(1024)
                     if data:
+                        self.logger.debug(r'%s' % (data.decode('utf-8', errors='ignore')))
                         bootlog += data
                         if self.serial_ports < 2:
                             # this socket has mixed console/kernel data, log it to logfile