diff mbox series

[V2] qemurunner: Improve qmp module detection PKG_CONFIG_SYSROOT_DIR for qmp module path

Message ID 20260107202553.2965393-3-t.f.g.geelen@gmail.com
State Changes Requested
Headers show
Series [V2] qemurunner: Improve qmp module detection PKG_CONFIG_SYSROOT_DIR for qmp module path | expand

Commit Message

Tom Geelen Jan. 7, 2026, 8:25 p.m. UTC
Instead of using logfile to detect where qmp is located we can use PKG_CONFIG_SYSROOT_DIR, passed via ENV to the launch function as this will point to the image recipe for which launch is called.

Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
---
 meta/lib/oeqa/utils/qemurunner.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Alexander Kanavin Jan. 7, 2026, 8:52 p.m. UTC | #1
On Wed, 7 Jan 2026 at 21:32, Tom Geelen <t.f.g.geelen@gmail.com> wrote:
>      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"
> +        # Use PKG_CONFIG_SYSROOT_DIR from env as a starting point for finding qmp module
> +        python_path = env.get("PKG_CONFIG_SYSROOT_DIR", "")
> +        python_path += "/../recipe-sysroot-native/usr/lib/qemu-python"

Thanks, I'm okay with this. It's not perfect, but it's short and very
unlikely to break.

Alex
Mathieu Dubois-Briand Jan. 8, 2026, 11:31 a.m. UTC | #2
On Wed Jan 7, 2026 at 9:25 PM CET, Tom Geelen via lists.openembedded.org wrote:
> Instead of using logfile to detect where qmp is located we can use PKG_CONFIG_SYSROOT_DIR, passed via ENV to the launch function as this will point to the image recipe for which launch is called.
>
> Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
> ---

Hi Tom,

Thanks for your patch.

This is failing on the autobuilder, with the following error:

2026-01-08 10:20:15,532 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/qemux86-tc/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py", line 390, in runqemu
    qemu.start(params=qemuparams, ssh=ssh, runqemuparams=runqemuparams, launch_cmd=launch_cmd, discard_writes=discard_writes)
  File "/srv/pokybuild/yocto-worker/qemux86-tc/build/layers/openembedded-core/meta/lib/oeqa/targetcontrol.py", line 179, in start
    raise RuntimeError("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
RuntimeError: core-image-minimal - FAILED to start qemu - check the task log and the boot log
...
DEBUG: Using kvm for runqemu
ERROR: qemurunner: qmp module missing, please ensure it's installed in /../recipe-sysroot-native/usr/lib/qemu-python (No module named 'qmp')

https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2925
https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2931
https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2925
https://autobuilder.yoctoproject.org/valkyrie/#/builders/66/builds/2975

Can you have a look at these issues?

Thanks,
Mathieu
Tom Geelen Jan. 8, 2026, 2:52 p.m. UTC | #3
Hi Mattieu,

Certainly. Question from my side. What is the exact setup that is used on
the autobuilder? Or the build commands for that matter.
I would like to reproduce this particular setup locally as well.

Regards,

Tom

On Thu, Jan 8, 2026 at 12:31 PM Mathieu Dubois-Briand <
mathieu.dubois-briand@bootlin.com> wrote:

> On Wed Jan 7, 2026 at 9:25 PM CET, Tom Geelen via lists.openembedded.org
> wrote:
> > Instead of using logfile to detect where qmp is located we can use
> PKG_CONFIG_SYSROOT_DIR, passed via ENV to the launch function as this will
> point to the image recipe for which launch is called.
> >
> > Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
> > ---
>
> Hi Tom,
>
> Thanks for your patch.
>
> This is failing on the autobuilder, with the following error:
>
> 2026-01-08 10:20:15,532 - oe-selftest - INFO -
> testtools.testresult.real._StringException: Traceback (most recent call
> last):
>   File
> "/srv/pokybuild/yocto-worker/qemux86-tc/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py",
> line 390, in runqemu
>     qemu.start(params=qemuparams, ssh=ssh, runqemuparams=runqemuparams,
> launch_cmd=launch_cmd, discard_writes=discard_writes)
>   File
> "/srv/pokybuild/yocto-worker/qemux86-tc/build/layers/openembedded-core/meta/lib/oeqa/targetcontrol.py",
> line 179, in start
>     raise RuntimeError("%s - FAILED to start qemu - check the task log and
> the boot log" % self.pn)
> RuntimeError: core-image-minimal - FAILED to start qemu - check the task
> log and the boot log
> ...
> DEBUG: Using kvm for runqemu
> ERROR: qemurunner: qmp module missing, please ensure it's installed in
> /../recipe-sysroot-native/usr/lib/qemu-python (No module named 'qmp')
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2925
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2931
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2925
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/66/builds/2975
>
> Can you have a look at these issues?
>
> Thanks,
> Mathieu
>
> --
> Mathieu Dubois-Briand, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
>
Mathieu Dubois-Briand Jan. 8, 2026, 5:34 p.m. UTC | #4
On Thu Jan 8, 2026 at 3:52 PM CET, Tom Geelen wrote:
> Hi Mattieu,
>
> Certainly. Question from my side. What is the exact setup that is used on
> the autobuilder? Or the build commands for that matter.
> I would like to reproduce this particular setup locally as well.
>
> Regards,
>
> Tom
>

Sure!

This is a toolchain test, so the command used by the autobuilder is:
oe-selftest -a -t machine -t toolchain-system -j 15

You have a lot of tests failing, so you might want to just run one
specific test. This can be done with something like:
oe-selftest -r gcc.GccCrossSelfTestSystemEmulated.test_cross_gcc

In terms of configuration, you can have a look at the config step of the
build:
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/4870597/raw_inline

But basically, you can probably try something like:
SDKMACHINE = "x86_64"
PACKAGE_CLASSES = "package_rpm package_deb package_ipk"
INHERIT += 'image-buildinfo'
IMAGE_BUILDINFO_VARS:append = ' IMAGE_BASENAME IMAGE_NAME'
IMAGE_INSTALL:append = ' ssh-pregen-hostkeys'
SANITY_TESTED_DISTROS = ''
EXTRA_IMAGE_FEATURES ?= 'allow-empty-password empty-root-password allow-root-login'
OE_FRAGMENTS += 'machine/qemux86 distro/poky'

Thanks,
Mathieu
diff mbox series

Patch

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index c4db0cf038..dd1ff42b0f 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -186,11 +186,9 @@  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"
+        # Use PKG_CONFIG_SYSROOT_DIR from env as a starting point for finding qmp module
+        python_path = env.get("PKG_CONFIG_SYSROOT_DIR", "")
+        python_path += "/../recipe-sysroot-native/usr/lib/qemu-python"
         sys.path.append(python_path)
         importlib.invalidate_caches()
         try: