<div dir="ltr"><div class="gmail_extra">There are two neater ways of doing this:</div><br>1) oe.types.boolean() which handles all the common aliases for true or false.<div>2)bitbake typed variables.  Do QEMU_USE_KVM[type]=&quot;boolean&quot; where it gets a default value, and then use oe.data.typed_value(&#39;QEMU_USE_KVM&#39;, d) to get the value.</div><div><br></div><div>Both ways move the actual value parsing to dedicated code so its less error prone and more consistent.</div><div><br></div><div>Ross</div><div><br><div class="gmail_extra"><div class="gmail_quote">On 14 November 2017 at 06:57, Robert Yang <span dir="ltr">&lt;<a href="mailto:liezhi.yang@windriver.com" target="_blank">liezhi.yang@windriver.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">It only could be set to &quot;True&quot;, which was not common in oe, e.g.:<br>
* Works<br>
QEMU_USE_KVM = &quot;True&quot;<br>
<br>
* Didn&#39;t work, this would surprise user.<br>
QEMU_USE_KVM = &quot;1&quot;<br>
<br>
Make it work with both 1 and True now, the &quot;True&quot; is for compatibility.<br>
<br>
[YOCTO #12343]<br>
<br>
Signed-off-by: Robert Yang &lt;<a href="mailto:liezhi.yang@windriver.com">liezhi.yang@windriver.com</a>&gt;<br>
---<br>
 meta/classes/testimage.bbclass | 2 +-<br>
 meta/lib/oeqa/targetcontrol.py | 2 +-<br>
 2 files changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/meta/classes/testimage.<wbr>bbclass b/meta/classes/testimage.<wbr>bbclass<br>
index 45bb2bd..66b4baf 100644<br>
--- a/meta/classes/testimage.<wbr>bbclass<br>
+++ b/meta/classes/testimage.<wbr>bbclass<br>
@@ -215,7 +215,7 @@ def testimage_main(d):<br>
     # Get use_kvm<br>
     qemu_use_kvm = d.getVar(&quot;QEMU_USE_KVM&quot;)<br>
     if qemu_use_kvm and \<br>
-       (qemu_use_kvm == &#39;True&#39; and &#39;x86&#39; in machine or \<br>
+       (qemu_use_kvm in (&#39;True&#39;, &#39;1&#39;) and &#39;x86&#39; in machine or \<br>
         d.getVar(&#39;MACHINE&#39;) in qemu_use_kvm.split()):<br>
         kvm = True<br>
     else:<br>
diff --git a/meta/lib/oeqa/targetcontrol.<wbr>py b/meta/lib/oeqa/targetcontrol.<wbr>py<br>
index f63936c..1625569 100644<br>
--- a/meta/lib/oeqa/targetcontrol.<wbr>py<br>
+++ b/meta/lib/oeqa/targetcontrol.<wbr>py<br>
@@ -107,7 +107,7 @@ class QemuTarget(BaseTarget):<br>
         dump_dir = d.getVar(&quot;TESTIMAGE_DUMP_DIR&quot;)<br>
         qemu_use_kvm = d.getVar(&quot;QEMU_USE_KVM&quot;)<br>
         if qemu_use_kvm and \<br>
-           (qemu_use_kvm == &quot;True&quot; and &quot;x86&quot; in d.getVar(&quot;MACHINE&quot;) or \<br>
+           (qemu_use_kvm in (&quot;True&quot;, &quot;1&quot;) and &quot;x86&quot; in d.getVar(&quot;MACHINE&quot;) or \<br>
             d.getVar(&quot;MACHINE&quot;) in qemu_use_kvm.split()):<br>
             use_kvm = True<br>
         else:<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div></div></div>