@@ -305,6 +305,7 @@ def testimage_main(d):
'serial_ports': len(d.getVar("SERIAL_CONSOLES").split()),
'ovmf' : ovmf,
'tmpfsdir' : d.getVar("RUNQEMU_TMPFS_DIR"),
+ 'native_sysroot': d.getVar("STAGING_DIR_NATIVE"),
}
if d.getVar("TESTIMAGE_BOOT_PATTERNS"):
@@ -22,7 +22,7 @@ class OEQemuTarget(OESSHTarget):
port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
dump_dir='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, serial_ports=2,
- boot_patterns = defaultdict(str), ovmf=False, tmpfsdir=None, **kwargs):
+ boot_patterns = defaultdict(str), ovmf=False, tmpfsdir=None, native_sysroot=None, **kwargs):
super(OEQemuTarget, self).__init__(logger, None, server_ip, timeout,
user, port)
@@ -44,7 +44,7 @@ class OEQemuTarget(OESSHTarget):
logfile=bootlog, boottime=boottime,
use_kvm=kvm, use_slirp=slirp, dump_dir=dump_dir, logger=logger,
serial_ports=serial_ports, boot_patterns = boot_patterns,
- use_ovmf=ovmf, tmpfsdir=tmpfsdir)
+ use_ovmf=ovmf, tmpfsdir=tmpfsdir, native_sysroot=native_sysroot)
def start(self, params=None, extra_bootparams=None, runqemuparams=''):
if self.use_slirp and not self.server_ip:
@@ -127,6 +127,7 @@ class QemuTarget(BaseTarget):
logfile = self.qemulog,
kernel = self.kernel,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
+ native_sysroot = d.getVar("RECIPE_SYSROOT_NATIVE"),
tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
logger = logger)
else:
@@ -140,6 +141,7 @@ class QemuTarget(BaseTarget):
use_kvm = use_kvm,
dump_dir = dump_dir,
logger = logger,
+ native_sysroot = d.getVar("RECIPE_SYSROOT_NATIVE"),
tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
serial_ports = len(d.getVar("SERIAL_CONSOLES").split()),
boot_patterns = boot_patterns)
@@ -45,7 +45,7 @@ def getOutput(o):
class QemuRunner:
def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, use_kvm, logger, use_slirp=False,
- serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
+ serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None, native_sysroot=None):
# Popen object for runqemu
self.runqemu = None
@@ -76,10 +76,13 @@ class QemuRunner:
self.msg = ''
self.boot_patterns = boot_patterns
self.tmpfsdir = tmpfsdir
+ self.native_sysroot = native_sysroot
self.runqemutime = 300
if not workdir:
workdir = os.getcwd()
+ # Store workdir for locating native sysroot (qmp bindings)
+ self.workdir = workdir
self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid())
self.monitorpipe = None
@@ -186,17 +189,16 @@ class QemuRunner:
return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env)
def launch(self, launch_cmd, get_ip = True, qemuparams = None, extra_bootparams = None, env = None):
- # use logfile to determine the recipe-sysroot-native path and
- # then add in the site-packages path components and add that
- # to the python sys.path so the qmp module can be found.
- python_path = os.path.dirname(os.path.dirname(self.logfile))
- python_path += "/recipe-sysroot-native/usr/lib/qemu-python"
+ if not self.native_sysroot:
+ self.logger.error("qemurunner: native_sysroot not provided; cannot locate qmp bindings")
+ return False
+ python_path = os.path.join(self.native_sysroot, "usr/lib/qemu-python")
sys.path.append(python_path)
importlib.invalidate_caches()
try:
qmp = importlib.import_module("qmp")
except Exception as e:
- self.logger.error("qemurunner: qmp module missing, please ensure it's installed in %s (%s)" % (python_path, str(e)))
+ self.logger.error("qemurunner: qmp module missing in %s (%s)" % (python_path, str(e)))
return False
# Path relative to tmpdir used as cwd for qemu below to avoid unix socket path length issues
qmp_file = "." + next(tempfile._get_candidate_names())
@@ -19,7 +19,7 @@ from .qemurunner import QemuRunner
class QemuTinyRunner(QemuRunner):
- def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, kernel, boottime, logger, tmpfsdir=None):
+ def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, kernel, boottime, logger, tmpfsdir=None, native_sysroot=None):
# Popen object for runqemu
self.runqemu = None
@@ -44,6 +44,7 @@ class QemuTinyRunner(QemuRunner):
self.server_socket = None
self.kernel = kernel
self.logger = logger
+ self.native_sysroot = native_sysroot
def create_socket(self):
Instead of using logfile to detect where qmp is located we can pass sysroot_native directly to the qemurunner so it can find the qmp module directly. Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com> --- meta/classes-recipe/testimage.bbclass | 1 + meta/lib/oeqa/core/target/qemu.py | 4 ++-- meta/lib/oeqa/targetcontrol.py | 2 ++ meta/lib/oeqa/utils/qemurunner.py | 16 +++++++++------- meta/lib/oeqa/utils/qemutinyrunner.py | 3 ++- 5 files changed, 16 insertions(+), 10 deletions(-)