Skip to contentSkip to conversation

oeqa/qemurunner: Improve handling of run_serial for shutdown commands

PATCH Superseded Richard Purdie 1 participant 1 message May 9, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/qemurunner: Improve handling of run_serial for shutdown commands

When running a shutdown command, the serial port can close without the command returning. This is seen as the socket being readable but having no data. Change the way this case is handled in the code to avoid tracebacks.

---
 meta/lib/oeqa/utils/qemurunner.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/qemurunner.py +6 -1
index 899152c7adc..e6137053887 100644
@@ -73,6 +73,8 @@ class QemuRunner:
         self.monitorpipe = None
 
         self.logger = logger
+        # Whether we're expecting an exit and should show related errors
+        self.allowexit = False
 
         # Enable testing other OS's
         # Set commands for target communication, and default to Linux ALWAYS
@@ -543,6 +545,7 @@ class QemuRunner:
             self.thread.join()
 
     def allowexit(self):
+        self.allowexit = True
         if self.thread:
             self.thread.allowexit()
 
@@ -604,7 +607,9 @@ class QemuRunner:
                     if re.search(self.boot_patterns['search_cmd_finished'], data):
                         break
                 else:
-                    raise Exception("No data on serial console socket")
+                    if self.allowexit:
+                        return (1, "")
+                    raise Exception("No data on serial console socket, connection closed?")
 
         if data:
             if raw:
Signature · 1 line
2.30.2