summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemutinyrunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/qemutinyrunner.py')
-rw-r--r--meta/lib/oeqa/utils/qemutinyrunner.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py
index d554f0dbcd..364005bd2d 100644
--- a/meta/lib/oeqa/utils/qemutinyrunner.py
+++ b/meta/lib/oeqa/utils/qemutinyrunner.py
@@ -1,6 +1,8 @@
+#
# Copyright (C) 2015 Intel Corporation
#
-# Released under the MIT license (see COPYING.MIT)
+# SPDX-License-Identifier: MIT
+#
# This module provides a class for starting qemu images of poky tiny.
# It's used by testimage.bbclass.
@@ -17,7 +19,7 @@ from .qemurunner import QemuRunner
class QemuTinyRunner(QemuRunner):
- def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, kernel, boottime):
+ def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, kernel, boottime, logger):
# Popen object for runqemu
self.runqemu = None
@@ -40,6 +42,7 @@ class QemuTinyRunner(QemuRunner):
self.socketfile = "console.sock"
self.server_socket = None
self.kernel = kernel
+ self.logger = logger
def create_socket(self):
@@ -60,7 +63,7 @@ class QemuTinyRunner(QemuRunner):
with open(self.logfile, "a") as f:
f.write("%s" % msg)
- def start(self, qemuparams = None, ssh=True, extra_bootparams=None):
+ def start(self, qemuparams = None, ssh=True, extra_bootparams=None, runqemuparams='', discard_writes=True):
if self.display:
os.environ["DISPLAY"] = self.display
@@ -107,14 +110,17 @@ class QemuTinyRunner(QemuRunner):
return self.is_alive()
- def run_serial(self, command):
+ def run_serial(self, command, timeout=60):
self.server_socket.sendall(command+'\n')
data = ''
status = 0
stopread = False
- endtime = time.time()+5
+ endtime = time.time()+timeout
while time.time()<endtime and not stopread:
- sread, _, _ = select.select([self.server_socket],[],[],5)
+ try:
+ sread, _, _ = select.select([self.server_socket],[],[],1)
+ except InterruptedError:
+ continue
for sock in sread:
answer = sock.recv(1024)
if answer:
@@ -124,6 +130,8 @@ class QemuTinyRunner(QemuRunner):
stopread = True
if not data:
status = 1
+ if not stopread:
+ data += "<<< run_serial(): command timed out after %d seconds without output >>>\r\n\r\n" % timeout
return (status, str(data))
def find_child(self,parent_pid):