Hi,

I haven't received any further feedback and I haven't seen it in
master-next yet. Is there something I am still missing?

Kind regards,

Tom

On Mon, Jan 12, 2026 at 10:49 AM Tom Geelen <[email protected]> wrote:

> 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
> itself.
>
> Signed-off-by: Tom Geelen <[email protected]>
> ---
>  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     | 14 +++++++-------
>  meta/lib/oeqa/utils/qemutinyrunner.py |  3 ++-
>  5 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/meta/classes-recipe/testimage.bbclass
> b/meta/classes-recipe/testimage.bbclass
> index 844c0f19ad..a5c7c4f34b 100644
> --- a/meta/classes-recipe/testimage.bbclass
> +++ b/meta/classes-recipe/testimage.bbclass
> @@ -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"):
> diff --git a/meta/lib/oeqa/core/target/qemu.py
> b/meta/lib/oeqa/core/target/qemu.py
> index 769a6fec7e..76c1ada02e 100644
> --- a/meta/lib/oeqa/core/target/qemu.py
> +++ b/meta/lib/oeqa/core/target/qemu.py
> @@ -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:
> diff --git a/meta/lib/oeqa/targetcontrol.py
> b/meta/lib/oeqa/targetcontrol.py
> index a9080077e2..fa6b43bb35 100644
> --- a/meta/lib/oeqa/targetcontrol.py
> +++ b/meta/lib/oeqa/targetcontrol.py
> @@ -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)
> diff --git a/meta/lib/oeqa/utils/qemurunner.py
> b/meta/lib/oeqa/utils/qemurunner.py
> index c4db0cf038..de26395bae 100644
> --- a/meta/lib/oeqa/utils/qemurunner.py
> +++ b/meta/lib/oeqa/utils/qemurunner.py
> @@ -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,6 +76,7 @@ class QemuRunner:
>          self.msg = ''
>          self.boot_patterns = boot_patterns
>          self.tmpfsdir = tmpfsdir
> +        self.native_sysroot = native_sysroot
>
>          self.runqemutime = 300
>          if not workdir:
> @@ -186,17 +187,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())
> diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py
> b/meta/lib/oeqa/utils/qemutinyrunner.py
> index 20009401ca..d1ccf65223 100644
> --- a/meta/lib/oeqa/utils/qemutinyrunner.py
> +++ b/meta/lib/oeqa/utils/qemutinyrunner.py
> @@ -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):
> --
> 2.43.0
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#229575): 
https://lists.openembedded.org/g/openembedded-core/message/229575
Mute This Topic: https://lists.openembedded.org/mt/117220989/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to