From 62a7a10c31bcf133cbd99d4de928f15a30e45ab1 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Tue, 9 Jun 2020 12:16:31 -0500 Subject: wic: Fix --extra-space argument handling 467f84e12b ("wic: Add --offset argument for partitions") broke the --extra-space argument handling in wic. Fix the option and add a unit test for the argument. Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie (cherry picked from commit 87722a92c18f94917c8f70afc8cd0763462a5c25) Signed-off-by: Steve Sakoman --- meta/lib/oeqa/selftest/cases/wic.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'meta/lib') diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 6d4068a527..a166d3f614 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -757,6 +757,21 @@ class Wic2(WicTestCase): p, _ = self._get_wic_partitions(tempf.name, ignore_status=True) self.assertNotEqual(p.status, 0, "wic exited successfully when an error was expected:\n%s" % p.output) + def test_extra_space(self): + native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools") + + with NamedTemporaryFile("w", suffix=".wks") as tempf: + tempf.write("bootloader --ptable gpt\n" \ + "part / --source rootfs --ondisk hda --extra-space 200M --fstype=ext4\n") + tempf.flush() + + _, partlns = self._get_wic_partitions(tempf.name, native_sysroot) + self.assertEqual(len(partlns), 1) + size = partlns[0].split(':')[3] + self.assertRegex(size, r'^[0-9]+kiB$') + size = int(size[:-3]) + self.assertGreaterEqual(size, 204800) + @only_for_arch(['i586', 'i686', 'x86_64']) def test_rawcopy_plugin_qemu(self): """Test rawcopy plugin in qemu""" -- cgit 1.2.3-korg