summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-09 10:59:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-15 17:18:21 +0100
commit4634aca5c2500fde16cdde3895776907ff7495e6 (patch)
tree60383542f21a235e98b4f5870b5e107126ff84d2
parent2f897b26bb7c3bacc41f7b3b108efd6e6a7e4968 (diff)
downloadpoky-4634aca5c2500fde16cdde3895776907ff7495e6.tar.gz
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. (From OE-Core rev: a72572532b976a4c3e8fa68fe63f63e39399ee88) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 396a3ba884820d040c91f7592daf20ac28c49b5d) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 526b493669..a0f17d557b 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -71,6 +71,8 @@ class QemuRunner:
71 self.monitorpipe = None 71 self.monitorpipe = None
72 72
73 self.logger = logger 73 self.logger = logger
74 # Whether we're expecting an exit and should show related errors
75 self.canexit = False
74 76
75 # Enable testing other OS's 77 # Enable testing other OS's
76 # Set commands for target communication, and default to Linux ALWAYS 78 # Set commands for target communication, and default to Linux ALWAYS
@@ -472,6 +474,7 @@ class QemuRunner:
472 self.thread.join() 474 self.thread.join()
473 475
474 def allowexit(self): 476 def allowexit(self):
477 self.canexit = True
475 if self.thread: 478 if self.thread:
476 self.thread.allowexit() 479 self.thread.allowexit()
477 480
@@ -530,7 +533,9 @@ class QemuRunner:
530 if re.search(self.boot_patterns['search_cmd_finished'], data): 533 if re.search(self.boot_patterns['search_cmd_finished'], data):
531 break 534 break
532 else: 535 else:
533 raise Exception("No data on serial console socket") 536 if self.canexit:
537 return (1, "")
538 raise Exception("No data on serial console socket, connection closed?")
534 539
535 if data: 540 if data:
536 if raw: 541 if raw: