diff mbox series

[1/2] oeqa/qemurunner: Add newlines serial workaround

Message ID 20231009165330.3580227-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 0a65f0d272895ba13c8c133ee71f3605d765a8a7
Headers show
Series [1/2] oeqa/qemurunner: Add newlines serial workaround | expand

Commit Message

Richard Purdie Oct. 9, 2023, 4:53 p.m. UTC
We're struggling with the 6.5 kernel as the serial port getty doesn't appears sometimes
leading to failures in CI. Add a workaround of sending some newlines as a way of
unblocking the kernel/release issues whilst we try and work out how to get to the bottom
of the issue.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/utils/qemurunner.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mikko Rapeli Oct. 10, 2023, 9:13 a.m. UTC | #1
Reviewed-by: Mikko Rapeli <mikko.rapeli@linaro.org>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 387addfcdfe..6c91570d1b5 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -444,9 +444,11 @@  class QemuRunner:
         self.logger.debug("Waiting at most %d seconds for login banner (%s)" %
                           (self.boottime, time.strftime("%D %H:%M:%S")))
         endtime = time.time() + self.boottime
+        newlinetime = time.time() + 120
         filelist = [self.server_socket, self.runqemu.stdout]
         reachedlogin = False
         stopread = False
+        sentnewlines = False
         qemusock = None
         bootlog = b''
         data = b''
@@ -455,6 +457,13 @@  class QemuRunner:
                 sread, swrite, serror = select.select(filelist, [], [], 5)
             except InterruptedError:
                 continue
+            # With the 6.5 kernel, the serial port getty sometimes fails to appear, the data
+            # appears lost in some buffer somewhere. Wait two minutes, then if we've not had a login,
+            # try and provoke one. This is a workaround until we can work out the root cause.
+            if time.time() > newlinetime and not sentnewlines:
+                self.logger.warning('Probing the serial port to wake it up!')
+                self.server_socket.sendall(bytes("\n\n", "utf-8"))
+                sentnewlines = True
             for file in sread:
                 if file is self.server_socket:
                     qemusock, addr = self.server_socket.accept()