From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v5 10/10] oe-selftest/cases/wic.py: oe-selftest -r wic.Wic2 -> PASS
Date: Mon, 23 Feb 2026 16:50:08 -0500 [thread overview]
Message-ID: <20260223215008.2062721-11-twoerner@gmail.com> (raw)
In-Reply-To: <20260223215008.2062721-1-twoerner@gmail.com>
Changes for the wic.Wic2 oe-selftests to pass now that wic is a
stand-alone app and no longer part of oe-core.
NOTE: the wic.Wic2.test_sparse_copy test was deleted since it tests code
that is internal to wic itself; which is no longer possible now
that wic is not part of oe-core.
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v5:
- rebase with master
- re-split up into multiple, smaller patches
- now that the sector-size re-implementation is ahead of this patch,
various wic subcommands (ls, cp, rm) no longer need a --vars file
- combine qemu and non-qemu patches together (were separate patches)
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large commit
changes in v2:
- none
---
meta/lib/oeqa/selftest/cases/wic.py | 70 ++++++++++-------------------
1 file changed, 24 insertions(+), 46 deletions(-)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 355c680f80ba..ea1742dab110 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1005,14 +1005,14 @@ class Wic2(WicTestCase):
def test_bmap_short(self):
"""Test generation of .bmap file -m option"""
- cmd = "wic create wictestdisk -e core-image-minimal -m -o %s" % self.resultdir
+ cmd = "wic create wictestdisk -e core-image-minimal -m -o %s -v %s" % (self.resultdir, self.envfile)
runCmd(cmd)
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct"))))
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct.bmap"))))
def test_bmap_long(self):
"""Test generation of .bmap file --bmap option"""
- cmd = "wic create wictestdisk -e core-image-minimal --bmap -o %s" % self.resultdir
+ cmd = "wic create wictestdisk -e core-image-minimal --bmap -o %s -v %s" % (self.resultdir, self.envfile)
runCmd(cmd)
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct"))))
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct.bmap"))))
@@ -1048,9 +1048,9 @@ class Wic2(WicTestCase):
native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
runCmd("wic create wictestdisk "
- "--image-name=%s -v %s -n %s -o %s"
+ "--image-name=%s -v %s -n %s -o %s -v %s"
% (image, imgenvdir, native_sysroot,
- self.resultdir))
+ self.resultdir, self.envfile))
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct"))))
def test_image_vars_dir_long(self):
@@ -1063,9 +1063,10 @@ class Wic2(WicTestCase):
"--image-name=%s "
"--vars %s "
"--native-sysroot %s "
- "--outdir %s"
+ "--outdir %s "
+ "--vars %s"
% (image, imgenvdir, native_sysroot,
- self.resultdir))
+ self.resultdir, self.envfile))
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct"))))
# TODO this test could also work on aarch64
@@ -1075,6 +1076,7 @@ class Wic2(WicTestCase):
config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\
'MACHINE_FEATURES:append = " efi"\n'
image_recipe_append = """
+DEPENDS:append = " wic-native"
do_image_wic[postfuncs] += "run_wic_cmd"
run_wic_cmd() {
echo "test" >> ${WORKDIR}/test.wic-cp
@@ -1115,6 +1117,7 @@ run_wic_cmd() {
'MACHINE_FEATURES:append = " efi"\n'
self.append_config(config)
image_recipe_append = """
+DEPENDS:append = " wic-native"
do_image_wic[postfuncs] += "run_wic_cmd"
run_wic_cmd() {
echo "test" >> ${WORKDIR}/test.wic-cp
@@ -1179,7 +1182,7 @@ run_wic_cmd() {
return wkspath
def _get_wic(self, wkspath, ignore_status=False):
- p = runCmd("wic create %s -e core-image-minimal -o %s" % (wkspath, self.resultdir),
+ p = runCmd("wic create %s -e core-image-minimal -o %s -v %s" % (wkspath, self.resultdir, self.envfile),
ignore_status=ignore_status)
if p.status:
@@ -1420,7 +1423,7 @@ run_wic_cmd() {
wks.write('part / --source rawcopy --sourceparams="file=%s.%s%s"\n'\
% (bb_vars['IMAGE_LINK_NAME'], fstype, params))
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, image, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, image, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1513,7 +1516,7 @@ run_wic_cmd() {
'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\
'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
@@ -1525,6 +1528,7 @@ run_wic_cmd() {
config = 'IMAGE_EFI_BOOT_FILES="/etc/fstab;testfile"\nIMAGE_FSTYPES = "wic"\nWKS_FILE = "test_uefikernel.wks"\nMACHINE_FEATURES:append = " efi"\n'
self.append_config(config)
bitbake('core-image-minimal')
+ envfile = self._create_image_env_file('core-image-minimal')
self.remove_config(config)
img = 'core-image-minimal'
@@ -1533,7 +1537,7 @@ run_wic_cmd() {
'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\
'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
@@ -1678,6 +1682,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
"
""")
self.append_config(config)
+ self.envfile = self._create_image_env_file('core-image-minimal')
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
@@ -1748,7 +1753,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
'part emptyext2 --fstype ext2 --size 1M\n',
'part emptybtrfs --fstype btrfs --size 150M\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1760,7 +1765,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
wks.writelines(['part / --fstype ext3 --source rootfs --system-id 0xFF '\
'--overhead-factor 1.2 --size 100k\n'])
wks.flush()
- cmd = "wic create %s -e core-image-minimal -o %s" % (wks.name, self.resultdir)
+ cmd = "wic create %s -e core-image-minimal -o %s -v %s" % (wks.name, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1769,41 +1774,14 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
def test_image_bootpart_globbed(self):
"""Test globbed sources with image-bootpart plugin"""
img = "core-image-minimal"
- cmd = "wic create sdimage-bootpart -e %s -o %s" % (img, self.resultdir)
config = 'IMAGE_BOOT_FILES = "%s*"' % get_bb_var('KERNEL_IMAGETYPE', img)
self.append_config(config)
+ envfile = self._create_image_env_file(img)
+ cmd = "wic create sdimage-bootpart -e %s -o %s -v %s" % (img, self.resultdir, envfile)
runCmd(cmd)
self.remove_config(config)
self.assertEqual(1, len(glob(os.path.join(self.resultdir, "sdimage-bootpart-*direct"))))
- def test_sparse_copy(self):
- """Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs"""
- libpath = os.path.join(self.td['COREBASE'], 'scripts', 'lib', 'wic')
- sys.path.insert(0, libpath)
- from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp
- with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse:
- src_name = sparse.name
- src_size = 1024 * 10
- sparse.truncate(src_size)
- # write one byte to the file
- with open(src_name, 'r+b') as sfile:
- sfile.seek(1024 * 4)
- sfile.write(b'\x00')
- dest = sparse.name + '.out'
- # copy src file to dest using different filemap APIs
- for api in (FilemapFiemap, FilemapSeek, None):
- if os.path.exists(dest):
- os.unlink(dest)
- try:
- sparse_copy(sparse.name, dest, api=api)
- except ErrorNotSupp:
- continue # skip unsupported API
- dest_stat = os.stat(dest)
- self.assertEqual(dest_stat.st_size, src_size)
- # 8 blocks is 4K (physical sector size)
- self.assertEqual(dest_stat.st_blocks, 8)
- os.unlink(dest)
-
def test_mkfs_extraopts(self):
"""Test wks option --mkfs-extraopts for empty and not empty partitions"""
img = 'core-image-minimal'
@@ -1817,7 +1795,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
'part emptyext2 --fstype ext2 --size 1M --mkfs-extraopts "-D -F -i 8192"\n',
'part emptybtrfs --fstype btrfs --size 100M --mkfs-extraopts "--mixed -K"\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1916,7 +1894,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
'part empty --source empty --sourceparams="size=2048k,bs=512K" --ondisk sda --size 4M --align 1024\n'
])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
wicout = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1934,7 +1912,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
with NamedTemporaryFile("w", suffix=".wks") as wks:
wks.writelines(['part empty --source empty --sourceparams="fill" --ondisk sda --size 1M\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
result = runCmd(cmd, ignore_status=True)
self.assertIn("Source parameter 'fill' only works with the '--fixed-size' option, exiting.", result.output)
self.assertNotEqual(0, result.status)
@@ -1948,7 +1926,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
'part /boot --size=100M --active --fstype=ext4 --label boot\n'
'part / --source rootfs --fstype=ext4 --label root\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1966,7 +1944,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
'part /boot --size=100M --active --fstype=ext4 --label boot\n'
'part / --source rootfs --fstype=ext4 --label root\n'])
wks.flush()
- cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile)
runCmd(cmd)
wksname = os.path.splitext(os.path.basename(wks.name))[0]
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
--
2.51.0
prev parent reply other threads:[~2026-02-23 21:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 21:49 [PATCH v5 00/10] standalone wic Trevor Woerner
2026-02-23 21:49 ` [PATCH v5 01/10] wic: re-implement sector-size support Trevor Woerner
2026-02-24 9:52 ` [OE-core] " Paul Barker
2026-02-24 18:40 ` Trevor Woerner
2026-02-24 21:35 ` Paul Barker
2026-02-23 21:50 ` [PATCH v5 02/10] ufs image class: add Trevor Woerner
2026-02-24 10:02 ` [OE-core] " Paul Barker
2026-02-24 10:15 ` Paul Barker
2026-02-24 17:56 ` Trevor Woerner
2026-02-24 21:17 ` Paul Barker
2026-02-25 0:38 ` Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 03/10] wic: remove Trevor Woerner
2026-02-24 10:05 ` [OE-core] " Paul Barker
2026-02-24 17:37 ` Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 04/10] wic: provide oe-core wks files Trevor Woerner
2026-02-24 10:08 ` [OE-core] " Paul Barker
2026-02-24 17:38 ` Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 05/10] wic: add recipe Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 06/10] oe-selftest/cases/wic.py: update WicTestCase Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 07/10] oe-selftest/cases/wic.py: oe-selftest -r wic.CLITests -> PASS Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 08/10] oe-selftest/cases/wic.py: oe-selftest -r wic.ModifyTests " Trevor Woerner
2026-02-23 21:50 ` [PATCH v5 09/10] oe-selftest/cases/wic.py: oe-selftest -r wic.Wic " Trevor Woerner
2026-02-23 21:50 ` Trevor Woerner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260223215008.2062721-11-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.