]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/qemurunner: Improve handling of run_serial for shutdown commands
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 May 2021 09:59:44 +0000 (10:59 +0100)
committerAnuj Mittal <anuj.mittal@intel.com>
Tue, 11 May 2021 05:13:37 +0000 (13:13 +0800)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 396a3ba884820d040c91f7592daf20ac28c49b5d)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
meta/lib/oeqa/utils/qemurunner.py

index 526b493669c3c536198cbb56106b88dfb1f66167..a0f17d557b209eff2a336d5db0409c03c6b2b72f 100644 (file)
@@ -71,6 +71,8 @@ class QemuRunner:
         self.monitorpipe = None
 
         self.logger = logger
+        # Whether we're expecting an exit and should show related errors
+        self.canexit = False
 
         # Enable testing other OS's
         # Set commands for target communication, and default to Linux ALWAYS
@@ -472,6 +474,7 @@ class QemuRunner:
             self.thread.join()
 
     def allowexit(self):
+        self.canexit = True
         if self.thread:
             self.thread.allowexit()
 
@@ -530,7 +533,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.canexit:
+                        return (1, "")
+                    raise Exception("No data on serial console socket, connection closed?")
 
         if data:
             if raw: