summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@linaro.org>2024-10-23 15:08:38 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-25 15:12:22 +0100
commit18c123d8da59a6f8483662cb0977089d7a0736f5 (patch)
treeaf6732af6239356bad42aaed7a17f0e24f925412 /meta/lib/oeqa
parenta7c025cc11731e08bb23a700eabe9faf0c513c30 (diff)
downloadpoky-18c123d8da59a6f8483662cb0977089d7a0736f5.tar.gz
oeqa selftest wic.py: support UKIs via uki.bbclass
Use label to detect rootfs since UKI with kernel command line is generated before rootfs is generated by wic. Adapt wic tests to build and boot uki.bbclass generated UKIs. Keeping one UKI test in wic.py and rest of the UKI features are tested with dedicated uki.py test. Add plain non-UKI systemd-boot tests to wic suite for aarch64 and x86. (From OE-Core rev: 3f94256b977637d4276f82db7c20b8b5e57b9d86) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py120
1 files changed, 108 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index f2a46c965b..9b09be75ec 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1292,24 +1292,46 @@ class Wic2(WicTestCase):
1292 @skipIfNotArch(['i586', 'i686', 'x86_64']) 1292 @skipIfNotArch(['i586', 'i686', 'x86_64'])
1293 @OETestTag("runqemu") 1293 @OETestTag("runqemu")
1294 def test_efi_plugin_unified_kernel_image_qemu(self): 1294 def test_efi_plugin_unified_kernel_image_qemu(self):
1295 """Test efi plugin's Unified Kernel Image feature in qemu""" 1295 """Test Unified Kernel Image feature in qemu without systemd in initramfs or rootfs"""
1296 config = 'IMAGE_FSTYPES = "wic"\n'\ 1296 config = """
1297 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\ 1297# efi firmware must load systemd-boot, not grub
1298 'WKS_FILE = "test_efi_plugin.wks"\n'\ 1298EFI_PROVIDER = "systemd-boot"
1299 'MACHINE_FEATURES:append = " efi"\n' 1299
1300# image format must be wic, needs esp partition for firmware etc
1301IMAGE_FSTYPES:pn-core-image-base:append = " wic"
1302WKS_FILE = "test_efi_plugin.wks"
1303
1304# efi, uki and systemd features must be enabled
1305MACHINE_FEATURES:append = " efi"
1306DISTRO_FEATURES_NATIVE:append = " systemd"
1307IMAGE_CLASSES:append:pn-core-image-base = " uki"
1308
1309# uki embeds also an initrd, no systemd or udev
1310INITRAMFS_IMAGE = "core-image-initramfs-boot"
1311
1312# runqemu must not load kernel separately, it's in the uki
1313QB_KERNEL_ROOT = ""
1314QB_DEFAULT_KERNEL = "none"
1315
1316# boot command line provided via uki, not via bootloader
1317UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}"
1318
1319"""
1300 self.append_config(config) 1320 self.append_config(config)
1301 bitbake('core-image-minimal core-image-minimal-initramfs ovmf') 1321 bitbake('core-image-base ovmf')
1322 runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base') or ""
1323 uki_filename = get_bb_var('UKI_FILENAME', 'core-image-base')
1302 self.remove_config(config) 1324 self.remove_config(config)
1303 1325
1304 with runqemu('core-image-minimal', ssh=False, 1326 with runqemu('core-image-base', ssh=False,
1305 runqemuparams='nographic ovmf', image_fstype='wic') as qemu: 1327 runqemuparams='%s nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu:
1306 # Check that /boot has EFI bootx64.efi (required for EFI) 1328 # Check that /boot has EFI boot*.efi (required for EFI)
1307 cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l" 1329 cmd = "ls /boot/EFI/BOOT/boot*.efi | wc -l"
1308 status, output = qemu.run_serial(cmd) 1330 status, output = qemu.run_serial(cmd)
1309 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) 1331 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1310 self.assertEqual(output, '1') 1332 self.assertEqual(output, '1')
1311 # Check that /boot has EFI/Linux/linux.efi (required for Unified Kernel Images auto detection) 1333 # Check that /boot has EFI/Linux/${UKI_FILENAME} (required for Unified Kernel Images auto detection)
1312 cmd = "ls /boot/EFI/Linux/linux.efi | wc -l" 1334 cmd = "ls /boot/EFI/Linux/%s | wc -l" % (uki_filename)
1313 status, output = qemu.run_serial(cmd) 1335 status, output = qemu.run_serial(cmd)
1314 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) 1336 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1315 self.assertEqual(output, '1') 1337 self.assertEqual(output, '1')
@@ -1319,6 +1341,80 @@ class Wic2(WicTestCase):
1319 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) 1341 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1320 self.assertEqual(output, '0') 1342 self.assertEqual(output, '0')
1321 1343
1344 @skipIfNotArch(['aarch64'])
1345 @OETestTag("runqemu")
1346 def test_efi_plugin_plain_systemd_boot_qemu_aarch64(self):
1347 """Test plain systemd-boot in qemu with systemd"""
1348 config = """
1349INIT_MANAGER = "systemd"
1350EFI_PROVIDER = "systemd-boot"
1351
1352# image format must be wic, needs esp partition for firmware etc
1353IMAGE_FSTYPES:pn-core-image-base:append = " wic"
1354WKS_FILE = "test_efi_plugin_plain_systemd-boot.wks"
1355
1356INITRAMFS_IMAGE = "core-image-initramfs-boot"
1357
1358# to configure runqemu
1359IMAGE_CLASSES += "qemuboot"
1360# u-boot efi firmware
1361QB_DEFAULT_BIOS = "u-boot.bin"
1362# need to use virtio, scsi not supported by u-boot by default
1363QB_DRIVE_TYPE = "/dev/vd"
1364
1365# disable kvm, breaks boot
1366QEMU_USE_KVM = ""
1367
1368IMAGE_CLASSES:remove = 'testimage'
1369"""
1370 self.append_config(config)
1371 bitbake('core-image-base u-boot')
1372 runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base') or ""
1373 self.remove_config(config)
1374
1375 with runqemu('core-image-base', ssh=False,
1376 runqemuparams='%s nographic' % (runqemu_params), image_fstype='wic') as qemu:
1377 # Check that /boot has EFI boot*.efi (required for EFI)
1378 cmd = "ls /boot/EFI/BOOT/boot*.efi | wc -l"
1379 status, output = qemu.run_serial(cmd)
1380 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1381 self.assertEqual(output, '1')
1382 # Check that boot.conf exists
1383 cmd = "cat /boot/loader/entries/boot.conf"
1384 status, output = qemu.run_serial(cmd)
1385 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1386
1387 @skipIfNotArch(['i586', 'i686', 'x86_64'])
1388 @OETestTag("runqemu")
1389 def test_efi_plugin_plain_systemd_boot_qemu_x86(self):
1390 """Test plain systemd-boot to systemd in qemu"""
1391 config = """
1392INIT_MANAGER = "systemd"
1393EFI_PROVIDER = "systemd-boot"
1394
1395# image format must be wic, needs esp partition for firmware etc
1396IMAGE_FSTYPES:pn-core-image-base:append = " wic"
1397WKS_FILE = "test_efi_plugin_plain_systemd-boot.wks"
1398
1399INITRAMFS_IMAGE = "core-image-initramfs-boot"
1400"""
1401 self.append_config(config)
1402 bitbake('core-image-base ovmf')
1403 runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base') or ""
1404 self.remove_config(config)
1405
1406 with runqemu('core-image-base', ssh=False,
1407 runqemuparams='%s nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu:
1408 # Check that /boot has EFI boot*.efi (required for EFI)
1409 cmd = "ls /boot/EFI/BOOT/boot*.efi | wc -l"
1410 status, output = qemu.run_serial(cmd)
1411 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1412 self.assertEqual(output, '1')
1413 # Check that boot.conf exists
1414 cmd = "cat /boot/loader/entries/boot.conf"
1415 status, output = qemu.run_serial(cmd)
1416 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1417
1322 def test_fs_types(self): 1418 def test_fs_types(self):
1323 """Test filesystem types for empty and not empty partitions""" 1419 """Test filesystem types for empty and not empty partitions"""
1324 img = 'core-image-minimal' 1420 img = 'core-image-minimal'