summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-11-09 19:31:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-11 13:43:40 +0000
commitaa2016bcee3cda137b662faf3d5b5ac0b923fa3c (patch)
tree94c1281cf19ada505e95c2fd6d30b8e60300f7bc
parent31926bd1c10bf7a7581c54d90739be9d0ce570df (diff)
downloadpoky-aa2016bcee3cda137b662faf3d5b5ac0b923fa3c.tar.gz
oeqa/selftest/runqemu: don't hardcode qemux86-64
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. (From OE-Core rev: a30680a869ff3be63d26468f6365751c56bbb006) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/runqemu.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py
index c1d277a095..58a4526df6 100644
--- a/meta/lib/oeqa/selftest/cases/runqemu.py
+++ b/meta/lib/oeqa/selftest/cases/runqemu.py
@@ -9,6 +9,7 @@ import tempfile
9import time 9import time
10import oe.types 10import oe.types
11from oeqa.core.decorator import OETestTag 11from oeqa.core.decorator import OETestTag
12from oeqa.core.decorator.data import skipIfNotArch, skipIfNotMachine
12from oeqa.selftest.case import OESelftestTestCase 13from oeqa.selftest.case import OESelftestTestCase
13from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd 14from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd
14 15
@@ -22,23 +23,25 @@ class RunqemuTests(OESelftestTestCase):
22 def setUpLocal(self): 23 def setUpLocal(self):
23 super(RunqemuTests, self).setUpLocal() 24 super(RunqemuTests, self).setUpLocal()
24 self.recipe = 'core-image-minimal' 25 self.recipe = 'core-image-minimal'
25 self.machine = 'qemux86-64' 26 self.machine = self.td['MACHINE']
26 self.fstypes = "ext4 iso hddimg wic.vmdk wic.qcow2 wic.vdi" 27
27 self.cmd_common = "runqemu nographic" 28 self.fstypes = "ext4"
29 if self.td["HOST_ARCH"] in ('i586', 'i686', 'x86_64'):
30 self.fstypes += " iso hddimg"
31 if self.machine == "qemux86-64":
32 self.fstypes += " wic.vmdk wic.qcow2 wic.vdi"
28 33
29 kvm = oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), 'x86_64') 34 self.cmd_common = "runqemu nographic"
35 kvm = oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), self.td["TARGET_ARCH"])
30 if kvm: 36 if kvm:
31 self.cmd_common += " kvm" 37 self.cmd_common += " kvm"
32 38
33 self.write_config( 39 self.write_config(
34""" 40"""
35MACHINE = "%s"
36IMAGE_FSTYPES = "%s" 41IMAGE_FSTYPES = "%s"
37# 10 means 1 second 42# 10 means 1 second
38SYSLINUX_TIMEOUT = "10" 43SYSLINUX_TIMEOUT = "10"
39""" 44""" % self.fstypes)
40% (self.machine, self.fstypes)
41 )
42 45
43 if not RunqemuTests.image_is_ready: 46 if not RunqemuTests.image_is_ready:
44 RunqemuTests.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') 47 RunqemuTests.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
@@ -59,6 +62,7 @@ SYSLINUX_TIMEOUT = "10"
59 with open(qemu.qemurunnerlog) as f: 62 with open(qemu.qemurunnerlog) as f:
60 self.assertIn('rootfs.ext4', f.read(), "Failed: %s" % cmd) 63 self.assertIn('rootfs.ext4', f.read(), "Failed: %s" % cmd)
61 64
65 @skipIfNotArch(['i586', 'i686', 'x86_64'])
62 def test_boot_machine_iso(self): 66 def test_boot_machine_iso(self):
63 """Test runqemu machine iso""" 67 """Test runqemu machine iso"""
64 cmd = "%s %s iso" % (self.cmd_common, self.machine) 68 cmd = "%s %s iso" % (self.cmd_common, self.machine)
@@ -73,7 +77,8 @@ SYSLINUX_TIMEOUT = "10"
73 with open(qemu.qemurunnerlog) as f: 77 with open(qemu.qemurunnerlog) as f:
74 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read())) 78 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
75 79
76 80 # https://bugzilla.yoctoproject.org/show_bug.cgi?id=14963
81 @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
77 def test_boot_recipe_image_vmdk(self): 82 def test_boot_recipe_image_vmdk(self):
78 """Test runqemu recipe-image vmdk""" 83 """Test runqemu recipe-image vmdk"""
79 cmd = "%s %s wic.vmdk" % (self.cmd_common, self.recipe) 84 cmd = "%s %s wic.vmdk" % (self.cmd_common, self.recipe)
@@ -81,6 +86,7 @@ SYSLINUX_TIMEOUT = "10"
81 with open(qemu.qemurunnerlog) as f: 86 with open(qemu.qemurunnerlog) as f:
82 self.assertIn('format=vmdk', f.read(), "Failed: %s" % cmd) 87 self.assertIn('format=vmdk', f.read(), "Failed: %s" % cmd)
83 88
89 @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
84 def test_boot_recipe_image_vdi(self): 90 def test_boot_recipe_image_vdi(self):
85 """Test runqemu recipe-image vdi""" 91 """Test runqemu recipe-image vdi"""
86 cmd = "%s %s wic.vdi" % (self.cmd_common, self.recipe) 92 cmd = "%s %s wic.vdi" % (self.cmd_common, self.recipe)
@@ -96,6 +102,7 @@ SYSLINUX_TIMEOUT = "10"
96 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read())) 102 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
97 103
98 104
105 @skipIfNotArch(['i586', 'i686', 'x86_64'])
99 def test_boot_deploy_hddimg(self): 106 def test_boot_deploy_hddimg(self):
100 """Test runqemu deploy_dir_image hddimg""" 107 """Test runqemu deploy_dir_image hddimg"""
101 cmd = "%s %s hddimg" % (self.cmd_common, self.deploy_dir_image) 108 cmd = "%s %s hddimg" % (self.cmd_common, self.deploy_dir_image)
@@ -110,6 +117,7 @@ SYSLINUX_TIMEOUT = "10"
110 with open(qemu.qemurunnerlog) as f: 117 with open(qemu.qemurunnerlog) as f:
111 self.assertIn(' -netdev user', f.read(), "Failed: %s" % cmd) 118 self.assertIn(' -netdev user', f.read(), "Failed: %s" % cmd)
112 119
120 @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
113 def test_boot_machine_slirp_qcow2(self): 121 def test_boot_machine_slirp_qcow2(self):
114 """Test runqemu machine slirp qcow2""" 122 """Test runqemu machine slirp qcow2"""
115 cmd = "%s slirp wic.qcow2 %s" % (self.cmd_common, self.machine) 123 cmd = "%s slirp wic.qcow2 %s" % (self.cmd_common, self.machine)