Re: [OE-core] [PATCH 12/14] selftest: efibootpartition.py: fix QEMU_USE_KVM usage

Martin Jansa
2023-04-05T15:17:59Z

[-- Attachment #1: Type: text/plain, Size: 6250 bytes --]

On Mon, Mar 13, 2023 at 1:16 PM Martin Jansa via lists.openembedded.org
<Martin.Jansa=gmail.com@lists.openembedded.org> wrote:

> * it's not in self.td causing:
> 2023-03-12 18:06:29,591 - oe-selftest - DEBUG - Checking if qemux86-64
> is not this MACHINE
> 2023-03-12 18:06:29,594 - oe-selftest - INFO - ... ERROR
> 2023-03-12 18:06:29,594 - oe-selftest - INFO - Traceback (most recent
> call last):
> File "/OE/build/poky/meta/lib/oeqa/core/decorator/__init__.py", line
> 35, in wrapped_f
> return func(*args, **kwargs)
> ^^^^^^^^^^^^^^^^^^^^^
> File
> "/OE/build/poky/meta/lib/oeqa/selftest/cases/efibootpartition.py", line 18,
> in test_boot_efi
> if oe.types.qemu_use_kvm(self.td['QEMU_USE_KVM'], self.td
> ["TARGET_ARCH"]):
> ~~~~~~~^^^^^^^^^^^^^^^^
> KeyError: 'QEMU_USE_KVM'
>
> [YOCTO #12937]
>
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
> meta/lib/oeqa/selftest/cases/efibootpartition.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/lib/oeqa/selftest/cases/efibootpartition.py
> b/meta/lib/oeqa/selftest/cases/efibootpartition.py
> index e17da9f9a0..d34698c6ad 100644
> --- a/meta/lib/oeqa/selftest/cases/efibootpartition.py
> +++ b/meta/lib/oeqa/selftest/cases/efibootpartition.py
> @@ -6,7 +6,7 @@
> #
>
> from oeqa.selftest.case import OESelftestTestCase
> -from oeqa.utils.commands import bitbake, runqemu
> +from oeqa.utils.commands import bitbake, get_bb_var, runqemu
> from oeqa.core.decorator.data import skipIfNotMachine
> import oe.types
>
> @@ -15,7 +15,7 @@ class GenericEFITest(OESelftestTestCase):
> @skipIfNotMachine("qemux86-64", "test is qemux86-64 specific
> currently")
> def test_boot_efi(self):
> cmd = "runqemu nographic serial wic ovmf"
> - if oe.types.qemu_use_kvm(self.td['QEMU_USE_KVM'], self.td
> ["TARGET_ARCH"]):
> + if oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), self.td
> ["TARGET_ARCH"]):
> cmd += " kvm"
> image = "core-image-minimal"
>
> --
> 2.39.2
>

This is still reproducible with latest poky master:
0e5bdb623b0 xdg-utils: Fix CVE number

with just these 5 lines in local.conf:

BB_NUMBER_THREADS = "8"
BB_NUMBER_PARSE_THREADS = "64"
PARALLEL_MAKE = "-j 70 -l 140"
DL_DIR = "/OE/build/downloads"
SANITY_TESTED_DISTROS = ""

2023-04-05 17:00:33,452 - oe-selftest - WARNING - meta-selftest layer not
found in BBLAYERS, adding it
2023-04-05 17:01:03,686 - oe-selftest - INFO - Adding layer libraries:
2023-04-05 17:01:03,686 - oe-selftest - INFO - /OE/build/poky/meta-poky/lib
2023-04-05 17:01:03,686 - oe-selftest - INFO - /OE/build/poky/meta/lib
2023-04-05 17:01:03,686 - oe-selftest - INFO -
/OE/build/poky/meta-yocto-bsp/lib
2023-04-05 17:01:03,687 - oe-selftest - INFO -
/OE/build/poky/meta-selftest/lib
2023-04-05 17:01:03,689 - oe-selftest - INFO - Running bitbake -e to test
the configuration is valid/parsable
2023-04-05 17:01:18,699 - oe-selftest - INFO - Adding: "include
selftest.inc" in /OE/build/poky/build-st/conf/local.conf
2023-04-05 17:01:18,699 - oe-selftest - INFO - Adding: "include
bblayers.inc" in bblayers.conf
2023-04-05 17:01:18,699 - oe-selftest - INFO - test_boot_efi
(efibootpartition.GenericEFITest.test_boot_efi)
2023-04-05 17:01:18,700 - oe-selftest - DEBUG - Checking if qemux86-64 is
not this MACHINE
2023-04-05 17:01:18,707 - oe-selftest - INFO - ... ERROR
2023-04-05 17:01:18,708 - oe-selftest - INFO - Traceback (most recent call
last):
File "/OE/build/poky/meta/lib/oeqa/core/decorator/__init__.py", line 35,
in wrapped_f
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/OE/build/poky/meta/lib/oeqa/selftest/cases/efibootpartition.py",
line 18, in test_boot_efi
if oe.types.qemu_use_kvm(self.td['QEMU_USE_KVM'], self.td
["TARGET_ARCH"]):
~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'QEMU_USE_KVM'

2023-04-05 17:01:18,709 - oe-selftest - INFO -
======================================================================
2023-04-05 17:01:18,709 - oe-selftest - INFO - ERROR: test_boot_efi
(efibootpartition.GenericEFITest.test_boot_efi)
2023-04-05 17:01:18,709 - oe-selftest - INFO -
----------------------------------------------------------------------
2023-04-05 17:01:18,709 - oe-selftest - INFO - Traceback (most recent call
last):
File "/OE/build/poky/meta/lib/oeqa/core/decorator/__init__.py", line 35,
in wrapped_f
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/OE/build/poky/meta/lib/oeqa/selftest/cases/efibootpartition.py",
line 18, in test_boot_efi
if oe.types.qemu_use_kvm(self.td['QEMU_USE_KVM'], self.td
["TARGET_ARCH"]):
~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'QEMU_USE_KVM'

2023-04-05 17:01:18,710 - oe-selftest - INFO -
----------------------------------------------------------------------
2023-04-05 17:01:18,710 - oe-selftest - INFO - Ran 1 test in 7.873s
2023-04-05 17:01:18,710 - oe-selftest - INFO - FAILED
2023-04-05 17:01:18,710 - oe-selftest - INFO - (errors=1)
2023-04-05 17:01:28,486 - oe-selftest - INFO - RESULTS:
2023-04-05 17:01:28,487 - oe-selftest - INFO - RESULTS -
efibootpartition.GenericEFITest.test_boot_efi: ERROR (0.01s)
2023-04-05 17:01:28,488 - oe-selftest - INFO - SUMMARY:
2023-04-05 17:01:28,488 - oe-selftest - INFO - oe-selftest () - Ran 1 test
in 7.875s
2023-04-05 17:01:28,488 - oe-selftest - INFO - oe-selftest - FAIL -
Required tests failed (successes=0, skipped=0, failures=0, errors=1)

I was just following what runqemu selftest already does:
meta/lib/oeqa/selftest/cases/runqemu.py: kvm =
oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), self.td["TARGET_ARCH"])

I've discussed this with Ross (who introduced this in
https://git.openembedded.org/openembedded-core-contrib/commit/?h=jansa/pull&id=2bc2ee171f976807053b7da44c1eedbb07c10949)
and RP on IRC and also verified that adding:

QEMU_USE_KVM = "1"

to local.conf is possible work around, but still this fix is better as
selftest should work without any extra local.conf modifications.

Cheers,

[-- Attachment #2: Type: text/html, Size: 8360 bytes --]