summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorTrevor Woerner <twoerner@gmail.com>2025-04-30 22:35:15 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-05-01 14:22:54 +0100
commite97d88578c90cafef042142640a3687e3d6e2459 (patch)
tree8906ea8ae1e98ebc4d088e0a84ab6b83c5026185 /meta/lib/oeqa/selftest
parent75a7b0464165fed97e011a9cdd2572f997011245 (diff)
downloadpoky-e97d88578c90cafef042142640a3687e3d6e2459.tar.gz
oe-selftest.wic: add native sysroot handling
The wic test_exclude_path_with_extra_space does not succeed on debian-based AB workers since they, by default, do not install the 'parted' utility. This test installs the 'wic-tools' package, which includes the 'parted' utility, but it is not being found/used for some unknown reason. In the previous patch it was believed that doing some extra PATH handling (as performed by some other tests with a python try...finally block) would solve the issue. That turned out to not be the case. This patch starts by reverting that change, since it has no benefit. In order to use the native tools from the 'wic-tools' package, wic's '--native-sysroot' can be used (as demonstrated in other tests). In fact the wic help message explaining the purpose of this flag states that it is for passing "...the path to the native sysroot containing the tools(parted and mtools) to use"[sic]. Removing the host's 'parted' utility better simulates the situation found on the debian workers for testing. This patch is seen to make this test pass with no host 'parted' utility in place. (From OE-Core rev: 306e4831f07d4a8db6ab880487813a6abd0ffa08) Signed-off-by: Trevor Woerner <twoerner@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py64
1 files changed, 29 insertions, 35 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 60dce33911..267c7105c5 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -538,42 +538,36 @@ part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoa
538 def test_exclude_path_with_extra_space(self): 538 def test_exclude_path_with_extra_space(self):
539 """Test having --exclude-path with IMAGE_ROOTFS_EXTRA_SPACE. [Yocto #15555]""" 539 """Test having --exclude-path with IMAGE_ROOTFS_EXTRA_SPACE. [Yocto #15555]"""
540 540
541 oldpath = os.environ['PATH'] 541 with NamedTemporaryFile("w", suffix=".wks") as wks:
542 os.environ['PATH'] = get_bb_var("PATH", "wic-tools") 542 wks.writelines(
543 543 ['bootloader --ptable gpt\n',
544 try: 544 'part /boot --size=100M --active --fstype=ext4 --label boot\n',
545 with NamedTemporaryFile("w", suffix=".wks") as wks: 545 'part / --source rootfs --fstype=ext4 --label root --exclude-path boot/\n'])
546 wks.writelines( 546 wks.flush()
547 ['bootloader --ptable gpt\n', 547 config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\
548 'part /boot --size=100M --active --fstype=ext4 --label boot\n', 548 'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\
549 'part / --source rootfs --fstype=ext4 --label root --exclude-path boot/\n']) 549 'IMAGE_FSTYPES += "wic"\n'\
550 wks.flush() 550 'WKS_FILE = "%s"\n' % wks.name
551 config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\ 551 self.append_config(config)
552 'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\ 552 bitbake('core-image-minimal')
553 'IMAGE_FSTYPES += "wic"\n'\
554 'WKS_FILE = "%s"\n' % wks.name
555 self.append_config(config)
556 bitbake('core-image-minimal')
557
558 """
559 the output of "wic ls <image>.wic" will look something like:
560 Num Start End Size Fstype
561 1 17408 136332287 136314880 ext4
562 2 136332288 171464703 35132416 ext4
563 we are looking for the size of partition 2
564 i.e. in this case the number 35,132,416
565 without the fix the size will be around 85,403,648
566 with the fix the size should be around 799,960,064
567 """
568 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal')
569 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
570 machine = bb_vars['MACHINE']
571 wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0]
572 size_of_root_partition = int(runCmd("wic ls %s" % wicout).output.split('\n')[2].split()[3])
573 self.assertGreater(size_of_root_partition, 500000000)
574 553
575 finally: 554 """
576 os.environ['PATH'] = oldpath 555 the output of "wic ls <image>.wic" will look something like:
556 Num Start End Size Fstype
557 1 17408 136332287 136314880 ext4
558 2 136332288 171464703 35132416 ext4
559 we are looking for the size of partition 2
560 i.e. in this case the number 35,132,416
561 without the fix the size will be around 85,403,648
562 with the fix the size should be around 799,960,064
563 """
564 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal')
565 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
566 machine = bb_vars['MACHINE']
567 nativesysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
568 wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0]
569 size_of_root_partition = int(runCmd("wic ls %s --native-sysroot %s" % (wicout, nativesysroot)).output.split('\n')[2].split()[3])
570 self.assertGreater(size_of_root_partition, 500000000)
577 571
578 def test_include_path(self): 572 def test_include_path(self):
579 """Test --include-path wks option.""" 573 """Test --include-path wks option."""