Don't hardcode qemux86-64. This has some complications: the
IMAGE_FSTYPES needs to be constructed to reflect what the machine can
do (only x86 machines can build ISO images), and several tests which need
a wic file are currently limited to qemux86-64.

Signed-off-by: Ross Burton <[email protected]>
---
 meta/lib/oeqa/selftest/cases/runqemu.py | 26 ++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py 
b/meta/lib/oeqa/selftest/cases/runqemu.py
index c1d277a095a..58a4526df64 100644
--- a/meta/lib/oeqa/selftest/cases/runqemu.py
+++ b/meta/lib/oeqa/selftest/cases/runqemu.py
@@ -9,6 +9,7 @@ import tempfile
 import time
 import oe.types
 from oeqa.core.decorator import OETestTag
+from oeqa.core.decorator.data import skipIfNotArch, skipIfNotMachine
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd
 
@@ -22,23 +23,25 @@ class RunqemuTests(OESelftestTestCase):
     def setUpLocal(self):
         super(RunqemuTests, self).setUpLocal()
         self.recipe = 'core-image-minimal'
-        self.machine =  'qemux86-64'
-        self.fstypes = "ext4 iso hddimg wic.vmdk wic.qcow2 wic.vdi"
-        self.cmd_common = "runqemu nographic"
+        self.machine =  self.td['MACHINE']
+
+        self.fstypes = "ext4"
+        if self.td["HOST_ARCH"] in ('i586', 'i686', 'x86_64'):
+            self.fstypes += " iso hddimg"
+        if self.machine == "qemux86-64":
+            self.fstypes += " wic.vmdk wic.qcow2 wic.vdi"
 
-        kvm = oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), 'x86_64')
+        self.cmd_common = "runqemu nographic"
+        kvm = oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), 
self.td["TARGET_ARCH"])
         if kvm:
             self.cmd_common += " kvm"
 
         self.write_config(
 """
-MACHINE = "%s"
 IMAGE_FSTYPES = "%s"
 # 10 means 1 second
 SYSLINUX_TIMEOUT = "10"
-"""
-% (self.machine, self.fstypes)
-        )
+""" % self.fstypes)
 
         if not RunqemuTests.image_is_ready:
             RunqemuTests.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
@@ -59,6 +62,7 @@ SYSLINUX_TIMEOUT = "10"
             with open(qemu.qemurunnerlog) as f:
                 self.assertIn('rootfs.ext4', f.read(), "Failed: %s" % cmd)
 
+    @skipIfNotArch(['i586', 'i686', 'x86_64'])
     def test_boot_machine_iso(self):
         """Test runqemu machine iso"""
         cmd = "%s %s iso" % (self.cmd_common, self.machine)
@@ -73,7 +77,8 @@ SYSLINUX_TIMEOUT = "10"
             with open(qemu.qemurunnerlog) as f:
                 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, 
f.read()))
 
-
+    # https://bugzilla.yoctoproject.org/show_bug.cgi?id=14963
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
     def test_boot_recipe_image_vmdk(self):
         """Test runqemu recipe-image vmdk"""
         cmd = "%s %s wic.vmdk" % (self.cmd_common, self.recipe)
@@ -81,6 +86,7 @@ SYSLINUX_TIMEOUT = "10"
             with open(qemu.qemurunnerlog) as f:
                 self.assertIn('format=vmdk', f.read(), "Failed: %s" % cmd)
 
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
     def test_boot_recipe_image_vdi(self):
         """Test runqemu recipe-image vdi"""
         cmd = "%s %s wic.vdi" % (self.cmd_common, self.recipe)
@@ -96,6 +102,7 @@ SYSLINUX_TIMEOUT = "10"
                 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, 
f.read()))
 
 
+    @skipIfNotArch(['i586', 'i686', 'x86_64'])
     def test_boot_deploy_hddimg(self):
         """Test runqemu deploy_dir_image hddimg"""
         cmd = "%s %s hddimg" % (self.cmd_common, self.deploy_dir_image)
@@ -110,6 +117,7 @@ SYSLINUX_TIMEOUT = "10"
             with open(qemu.qemurunnerlog) as f:
                 self.assertIn(' -netdev user', f.read(), "Failed: %s" % cmd)
 
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
     def test_boot_machine_slirp_qcow2(self):
         """Test runqemu machine slirp qcow2"""
         cmd = "%s slirp wic.qcow2 %s" % (self.cmd_common, self.machine)
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173044): 
https://lists.openembedded.org/g/openembedded-core/message/173044
Mute This Topic: https://lists.openembedded.org/mt/94920925/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to