* [OE-core][PATCH] wic: Fix --extra-space argument handling
@ 2020-06-09 17:16 Joshua Watt
2020-06-09 19:07 ` Denys Dmytriyenko
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Watt @ 2020-06-09 17:16 UTC (permalink / raw)
To: openembedded-core; +Cc: denis, Joshua Watt
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 <JPEWhacker@gmail.com>
---
meta/lib/oeqa/selftest/cases/wic.py | 15 +++++++++++++++
scripts/lib/wic/ksparser.py | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 9e7be6168e..8b58285c32 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -908,6 +908,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"""
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 05ae292ef5..3453d9cb9d 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -145,7 +145,7 @@ class KickStart():
part.add_argument('--exclude-path', nargs='+')
part.add_argument('--include-path', nargs='+', action='append')
part.add_argument('--change-directory')
- part.add_argument("--extra-space", type=sizetype)
+ part.add_argument("--extra-space", type=sizetype("M"))
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype', default='vfat',
choices=('ext2', 'ext3', 'ext4', 'btrfs',
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core][PATCH] wic: Fix --extra-space argument handling
2020-06-09 17:16 [OE-core][PATCH] wic: Fix --extra-space argument handling Joshua Watt
@ 2020-06-09 19:07 ` Denys Dmytriyenko
0 siblings, 0 replies; 2+ messages in thread
From: Denys Dmytriyenko @ 2020-06-09 19:07 UTC (permalink / raw)
To: Joshua Watt; +Cc: openembedded-core
On Tue, Jun 09, 2020 at 12:16:31PM -0500, Joshua Watt wrote:
> 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 <JPEWhacker@gmail.com>
Tested-by: Denys Dmytriyenko <denys@ti.com>
> ---
> meta/lib/oeqa/selftest/cases/wic.py | 15 +++++++++++++++
> scripts/lib/wic/ksparser.py | 2 +-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
> index 9e7be6168e..8b58285c32 100644
> --- a/meta/lib/oeqa/selftest/cases/wic.py
> +++ b/meta/lib/oeqa/selftest/cases/wic.py
> @@ -908,6 +908,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"""
> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
> index 05ae292ef5..3453d9cb9d 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -145,7 +145,7 @@ class KickStart():
> part.add_argument('--exclude-path', nargs='+')
> part.add_argument('--include-path', nargs='+', action='append')
> part.add_argument('--change-directory')
> - part.add_argument("--extra-space", type=sizetype)
> + part.add_argument("--extra-space", type=sizetype("M"))
> part.add_argument('--fsoptions', dest='fsopts')
> part.add_argument('--fstype', default='vfat',
> choices=('ext2', 'ext3', 'ext4', 'btrfs',
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-09 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-09 17:16 [OE-core][PATCH] wic: Fix --extra-space argument handling Joshua Watt
2020-06-09 19:07 ` Denys Dmytriyenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox