Skip to contentSkip to conversation

testimage: fix boolean checking for QEMU_USE_KVM

PATCH In review Chen Qi 2 participants 3 messages Dec 4, 2018

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover testimage: fix boolean checking for QEMU_USE_KVM

*** BLURB HERE ***
The following changes since commit 016e3dda2d6acc9b457079d11b5346a5352a431d:

btrfs-tools: update to 4.19 (2018-12-03 12:20:01 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/qemu_use_kvm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/qemu_use_kvm

Chen Qi (1):
testimage: fix boolean checking for QEMU_USE_KVM

 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 testimage: fix boolean checking for QEMU_USE_KVM

If QEMU_USE_KVM is set to a list of machines, when doing testimage for a machine outside the list, we will get the following error.

Exception: ValueError: Invalid boolean value 'intel-corei7-64 intel-core2-32 qemux86 qemux86-64'

This is because oe.types.boolean raises error if the parameter is not values like 'true', 'false', etc.

Fix the boolean checking to avoid the exception.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +1 -1
index 82cbb06..80e457b 100644
@@ -231,7 +231,7 @@ def testimage_main(d):
     qemu_use_kvm = d.getVar("QEMU_USE_KVM")
     if qemu_use_kvm and \
        (d.getVar('MACHINE') in qemu_use_kvm.split() or \
-        oe.types.boolean(qemu_use_kvm) and 'x86' in machine):
+        qemu_use_kvm.lower() in ('yes', 'y', 'true', 't', '1') and 'x86' in machine):
         kvm = True
     else:
         kvm = False
Signature · 1 line
1.9.1
#2 lore raw
Quoted 27 lines · Chen Qi

If QEMU_USE_KVM is set to a list of machines, when doing testimage for a machine outside the list, we will get the following error.

Exception: ValueError: Invalid boolean value 'intel-corei7-64
intel-core2-32 qemux86 qemux86-64'

This is because oe.types.boolean raises error if the parameter is not values like 'true', 'false', etc.

Fix the boolean checking to avoid the exception.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +1 -1
index 82cbb06..80e457b 100644
@@ -231,7 +231,7 @@ def testimage_main(d):
     qemu_use_kvm = d.getVar("QEMU_USE_KVM")
     if qemu_use_kvm and \
        (d.getVar('MACHINE') in qemu_use_kvm.split() or \
-        oe.types.boolean(qemu_use_kvm) and 'x86' in machine):
+        qemu_use_kvm.lower() in ('yes', 'y', 'true', 't', '1') and
Quoted 4 lines

'x86' in machine):
kvm = True
else:
kvm = False

Personally, I think we should just drop support for listing the machines in QEMU_USE_KVM and suggest people use overrides instead?

Cheers,

Richard