aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 9ef7629c11..c0abb96546 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -416,7 +416,7 @@ class QemuRunner:
if "qemu-system" in basecmd and "-serial tcp" in commands[p]:
return [int(p),commands[p]]
- def run_serial(self, command, raw=False):
+ def run_serial(self, command, raw=False, timeout=5):
# We assume target system have echo to get command status
if not raw:
command = "%s; echo $?\n" % command
@@ -424,20 +424,23 @@ class QemuRunner:
data = ''
status = 0
self.server_socket.sendall(command.encode('utf-8'))
- keepreading = True
- while keepreading:
- sread, _, _ = select.select([self.server_socket],[],[],5)
+ start = time.time()
+ end = start + timeout
+ while True:
+ now = time.time()
+ if now >= end:
+ data += "<<< run_serial(): command timed out after %d seconds without output >>>\r\n\r\n" % timeout
+ break
+ sread, _, _ = select.select([self.server_socket],[],[], end - now)
if sread:
answer = self.server_socket.recv(1024)
if answer:
data += answer.decode('utf-8')
# Search the prompt to stop
if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
- keepreading = False
+ break
else:
raise Exception("No data on serial console socket")
- else:
- keepreading = False
if data:
if raw: