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-20 12:36:42 +0100
commit76c2624a1f820c8969342a0ea3d3e750e71e5d4d (patch)
tree4f831f9409430993236659c48e2de2fd70265baf
parent4f428303e02c37688018271210c5bdf7e3e4fc06 (diff)
downloadpoky-76c2624a1f820c8969342a0ea3d3e750e71e5d4d.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: 9c0b242856de519c58be179f82441a35fc635ad9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 396a3ba884820d040c91f7592daf20ac28c49b5d) Signed-off-by: Steve Sakoman <steve@sakoman.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 09ef9fadb2..79db2cc247 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -70,6 +70,8 @@ class QemuRunner:
70 self.monitorpipe = None 70 self.monitorpipe = None
71 71
72 self.logger = logger 72 self.logger = logger
73 # Whether we're expecting an exit and should show related errors
74 self.canexit = False
73 75
74 # Enable testing other OS's 76 # Enable testing other OS's
75 # Set commands for target communication, and default to Linux ALWAYS 77 # Set commands for target communication, and default to Linux ALWAYS
@@ -468,6 +470,7 @@ class QemuRunner:
468 self.thread.join() 470 self.thread.join()
469 471
470 def allowexit(self): 472 def allowexit(self):
473 self.canexit = True
471 if self.thread: 474 if self.thread:
472 self.thread.allowexit() 475 self.thread.allowexit()
473 476
@@ -526,7 +529,9 @@ class QemuRunner:
526 if re.search(self.boot_patterns['search_cmd_finished'], data): 529 if re.search(self.boot_patterns['search_cmd_finished'], data):
527 break 530 break
528 else: 531 else:
529 raise Exception("No data on serial console socket") 532 if self.canexit:
533 return (1, "")
534 raise Exception("No data on serial console socket, connection closed?")
530 535
531 if data: 536 if data:
532 if raw: 537 if raw: