[PATCH v9 3/5] selftest/cases/wic.py: remove test_sparse_copy

Trevor Woerner
2026-04-03T18:36:15Z

Delete the wic.Wic2.test_sparse_copy test since it tests code that is
internal to wic itself. Once wic is removed from oe-core it will not be
possible to test this function from this layer.

NOTE: this patch is in preparation for removing wic from oe-core
the wic oe-selftests work fine with this patch being added now

Reviewed-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Reviewed-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v9:
- in previous patchsets this was known as patch 9/9
"oe-selftest/cases/wic.py: oe-selftest -r wic.Wic2 -> PASS"
- previously this patch also included many modifications to the wic
oe-selftests to add a "--vars <envfile>" option; those are no longer
needed since wic will use bitbake to get variables if bitbake is
available on the PATH

changes in v8:
- (skipped, the only patch in v8 was to upstream the sector-size cmdline
option)

changes in v7:
- none

changes in v6:
- removed extraopts options that specify sector-size values for dos and
ext* partition types

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 | 28 ----------------------------
1 file changed, 28 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 791d265a5ee7..4e94f4d39abd 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1894,34 +1894,6 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
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'
--
2.51.0