Skip to contentSkip to conversation

wic: add test for partition hidden attributes

PATCH New [email protected] 1 participant 1 message Nov 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wic: add test for partition hidden attributes

From: Lee Chee Yang <[email protected]>

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

---
 meta/lib/oeqa/selftest/cases/wic.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
meta/lib/oeqa/selftest/cases/wic.py +24 -0
index b4866bcb32..ab248c5898 100644
@@ -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):
Signature · 1 line
2.37.3