wic: add test for partition hidden attributes

Add test for the --hidden argument introduced in Oe-Core
rev 7a111ff58d7390b79e2e63c8059f6c25f40f8977.

(From OE-Core rev: 819286cdce6471ca3dd048d3950b943b28e6d222)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Lee Chee Yang 2023-11-22 18:01:31 +08:00 committed by Richard Purdie
parent 0769ff28db
commit dfedec4b2d

View File

@ -748,6 +748,30 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc
os.remove(wks_file)
def test_partition_hidden_attributes(self):
"""Test --hidden wks option."""
wks_file = 'temp.wks'
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
try:
with open(wks_file, 'w') as wks:
wks.write("""
part / --source rootfs --fstype=ext4
part / --source rootfs --fstype=ext4 --hidden
bootloader --ptable gpt""")
runCmd("wic create %s -e core-image-minimal -o %s" \
% (wks_file, self.resultdir))
wicout = os.path.join(self.resultdir, "*.direct")
result = runCmd("%s/usr/sbin/sfdisk --part-attrs %s 1" % (sysroot, wicout))
self.assertEqual('', result.output)
result = runCmd("%s/usr/sbin/sfdisk --part-attrs %s 2" % (sysroot, wicout))
self.assertEqual('RequiredPartition', result.output)
finally:
os.remove(wks_file)
class Wic2(WicTestCase):
def test_bmap_short(self):