From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [RFC][PATCH v2 6/9] oe-selftest -r wic.ModifyTests -> PASS (except 1)
Date: Mon, 2 Feb 2026 12:07:57 -0500 [thread overview]
Message-ID: <20260202170800.4172778-7-twoerner@gmail.com> (raw)
In-Reply-To: <20260202170800.4172778-1-twoerner@gmail.com>
Changes for the wic.ModifyTests oe-selftests to pass now that wic is a
stand-alone app and no longer part of oe-core.
NOTE: wic.ModifyTests.test_wic_cp_ext fails
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
meta/lib/oeqa/selftest/cases/wic.py | 82 ++++++++++++++---------------
1 file changed, 41 insertions(+), 41 deletions(-)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index d8f89e79e7f2..0dc17dcd5614 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1958,44 +1958,44 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
class ModifyTests(WicTestCase):
def test_wic_ls(self):
"""Test listing image content using 'wic ls'"""
- runCmd("wic create wictestdisk "
+ runCmd("wic create wictestdisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct"))
self.assertEqual(1, len(images))
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
# list partitions
- result = runCmd("wic ls %s -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertEqual(3, len(result.output.split('\n')))
# list directory content of the first partition
- result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertEqual(6, len(result.output.split('\n')))
def test_wic_cp(self):
"""Test copy files and directories to the the wic image."""
- runCmd("wic create wictestdisk "
+ runCmd("wic create wictestdisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct"))
self.assertEqual(1, len(images))
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
# list directory content of the first partition
- result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertEqual(6, len(result.output.split('\n')))
with NamedTemporaryFile("w", suffix=".wic-cp") as testfile:
testfile.write("test")
# copy file to the partition
- runCmd("wic cp %s %s:1/ -n %s" % (testfile.name, images[0], sysroot))
+ runCmd("wic cp %s %s:1/ -n %s --vars %s" % (testfile.name, images[0], sysroot, self.envfile))
# check if file is there
- result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertEqual(7, len(result.output.split('\n')))
self.assertIn(os.path.basename(testfile.name), result.output)
@@ -2006,25 +2006,25 @@ class ModifyTests(WicTestCase):
copy(testfile.name, testdir)
# copy directory to the partition
- runCmd("wic cp %s %s:1/ -n %s" % (testdir, images[0], sysroot))
+ runCmd("wic cp %s %s:1/ -n %s --vars %s" % (testdir, images[0], sysroot, self.envfile))
# check if directory is there
- result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertEqual(8, len(result.output.split('\n')))
self.assertIn(os.path.basename(testdir), result.output)
# copy the file from the partition and check if it success
dest = '%s-cp' % testfile.name
- runCmd("wic cp %s:1/%s %s -n %s" % (images[0],
- os.path.basename(testfile.name), dest, sysroot))
+ runCmd("wic cp %s:1/%s %s -n %s --vars %s" % (images[0],
+ os.path.basename(testfile.name), dest, sysroot, self.envfile))
self.assertTrue(os.path.exists(dest), msg="File %s wasn't generated as expected" % dest)
def test_wic_rm(self):
"""Test removing files and directories from the the wic image."""
- runCmd("wic create mkefidisk "
+ runCmd("wic create mkefidisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "mkefidisk-*.direct"))
self.assertEqual(1, len(images))
@@ -2033,48 +2033,48 @@ class ModifyTests(WicTestCase):
kerneltype = get_bb_var('KERNEL_IMAGETYPE', 'virtual/kernel')
# list directory content of the first partition
- result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1 -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertIn('\n%s ' % kerneltype.upper(), result.output)
self.assertIn('\nEFI <DIR> ', result.output)
# remove file. EFI partitions are case-insensitive so exercise that too
- runCmd("wic rm %s:1/%s -n %s" % (images[0], kerneltype.lower(), sysroot))
+ runCmd("wic rm %s:1/%s -n %s --vars %s" % (images[0], kerneltype.lower(), sysroot, self.envfile))
# remove directory
- runCmd("wic rm %s:1/efi -n %s" % (images[0], sysroot))
+ runCmd("wic rm %s:1/efi -n %s --vars %s" % (images[0], sysroot, self.envfile))
# check if they're removed
- result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:1 -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertNotIn('\n%s ' % kerneltype.upper(), result.output)
self.assertNotIn('\nEFI <DIR> ', result.output)
def test_wic_ls_ext(self):
"""Test listing content of the ext partition using 'wic ls'"""
- runCmd("wic create wictestdisk "
+ runCmd("wic create wictestdisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct"))
self.assertEqual(1, len(images))
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
# list directory content of the second ext4 partition
- result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset(
set(line.split()[-1] for line in result.output.split('\n') if line)), msg="Expected directories not present %s" % result.output)
def test_wic_cp_ext(self):
"""Test copy files and directories to the ext partition."""
- runCmd("wic create wictestdisk "
+ runCmd("wic create wictestdisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct"))
self.assertEqual(1, len(images))
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
# list directory content of the ext4 partition
- result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
dirs = set(line.split()[-1] for line in result.output.split('\n') if line)
self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset(dirs), msg="Expected directories not present %s" % dirs)
@@ -2082,20 +2082,20 @@ class ModifyTests(WicTestCase):
testfile.write("test")
# copy file to the partition
- runCmd("wic cp %s %s:2/ -n %s" % (testfile.name, images[0], sysroot))
+ runCmd("wic cp %s %s:2/ -n %s --vars %s" % (testfile.name, images[0], sysroot, self.envfile))
# check if file is there
- result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
# check if the file to copy is in the partition
- result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/etc/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertIn('fstab', [line.split()[-1] for line in result.output.split('\n') if line])
# copy file from the partition, replace the temporary file content with it and
# check for the file size to validate the copy
- runCmd("wic cp %s:2/etc/fstab %s -n %s" % (images[0], testfile.name, sysroot))
+ runCmd("wic cp %s:2/etc/fstab %s -n %s --vars %s" % (images[0], testfile.name, sysroot, self.envfile))
self.assertTrue(os.stat(testfile.name).st_size > 0, msg="Filesize not as expected %s" % os.stat(testfile.name).st_size)
# prepare directory structure
@@ -2114,16 +2114,16 @@ class ModifyTests(WicTestCase):
f.write("sub-level\n")
# copy directory to the partition root
- runCmd("wic cp %s %s:2/ -n %s" % (testdir, images[0], sysroot))
+ runCmd("wic cp %s %s:2/ -n %s --vars %s" % (testdir, images[0], sysroot, self.envfile))
basedir = os.path.basename(testdir)
# check if directory is there at partition root
- result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
root_entries = set(line.split()[-1] for line in result.output.split('\n') if line)
self.assertIn(basedir, root_entries, msg="Expected directory not present at root: %s" % root_entries)
# list INSIDE the copied directory
- result = runCmd("wic ls %s:2/%s/ -n %s" % (images[0], basedir, sysroot))
+ result = runCmd("wic ls %s:2/%s/ -n %s --vars %s" % (images[0], basedir, sysroot, self.envfile))
self.assertEqual(0, result.status,
msg="wic ls inside copied directory failed. Output:\n%s" % result.output)
self.assertNotIn("Ext2 inode is not a directory", result.output,
@@ -2134,7 +2134,7 @@ class ModifyTests(WicTestCase):
msg="Expected entries missing inside dir: %s" % inside_entries)
# list inside the subdir
- result = runCmd("wic ls %s:2/%s/subdir/ -n %s" % (images[0], basedir, sysroot))
+ result = runCmd("wic ls %s:2/%s/subdir/ -n %s --vars %s" % (images[0], basedir, sysroot, self.envfile))
self.assertEqual(0, result.status,
msg="wic ls inside copied subdir failed. Output:\n%s" % result.output)
self.assertNotIn("Ext2 inode is not a directory", result.output,
@@ -2146,7 +2146,7 @@ class ModifyTests(WicTestCase):
# copy directory from the partition and compare with original
outparent = os.path.join(self.resultdir, "wic-test-cp-ext-out")
os.makedirs(outparent)
- runCmd("wic cp %s:2/%s %s -n %s" % (images[0], basedir, outparent, sysroot))
+ runCmd("wic cp %s:2/%s %s -n %s --vars %s" % (images[0], basedir, outparent, sysroot, self.envfile))
copied_dir = os.path.join(outparent, basedir)
self.assertTrue(os.path.isdir(copied_dir), msg="Copied-back directory not created: %s" % copied_dir)
@@ -2165,28 +2165,28 @@ class ModifyTests(WicTestCase):
def test_wic_rm_ext(self):
"""Test removing files from the ext partition."""
- runCmd("wic create mkefidisk "
+ runCmd("wic create mkefidisk --vars %s "
"--image-name=core-image-minimal "
- "-D -o %s" % self.resultdir)
+ "-D -o %s" % (self.envfile, self.resultdir))
images = glob(os.path.join(self.resultdir, "mkefidisk-*.direct"))
self.assertEqual(1, len(images))
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
# list directory content of the /etc directory on ext4 partition
- result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/etc/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertIn('fstab', [line.split()[-1] for line in result.output.split('\n') if line])
# remove file
- runCmd("wic rm %s:2/etc/fstab -n %s" % (images[0], sysroot))
+ runCmd("wic rm %s:2/etc/fstab -n %s --vars %s" % (images[0], sysroot, self.envfile))
# check if it's removed
- result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/etc/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertNotIn('fstab', [line.split()[-1] for line in result.output.split('\n') if line])
# remove non-empty directory
- runCmd("wic rm -r %s:2/etc/ -n %s" % (images[0], sysroot))
+ runCmd("wic rm -r %s:2/etc/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
# check if it's removed
- result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
+ result = runCmd("wic ls %s:2/ -n %s --vars %s" % (images[0], sysroot, self.envfile))
self.assertNotIn('etc', [line.split()[-1] for line in result.output.split('\n') if line])
--
2.51.0
next prev parent reply other threads:[~2026-02-02 17:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 17:07 [RFC][PATCH v2 0/9] standalone wic Trevor Woerner
2026-02-02 17:07 ` [RFC][PATCH v2 1/9] remove wic Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:07 ` [RFC][PATCH v2 2/9] provide oe-core wks files Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:07 ` [RFC][PATCH v2 3/9] add wic recipe Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:07 ` [RFC][PATCH v2 4/9] oe-selftest/cases/wic.py: update WicTestCase Trevor Woerner
2026-02-02 17:07 ` [RFC][PATCH v2 5/9] oe-selftest -r wic.CLITests -> PASS Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:07 ` Trevor Woerner [this message]
2026-02-02 17:16 ` Patchtest results for [RFC][PATCH v2 6/9] oe-selftest -r wic.ModifyTests -> PASS (except 1) patchtest
2026-02-02 17:07 ` [RFC][PATCH v2 7/9] oe-selftest -r wic.Wic -> PASS Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:07 ` [RFC][PATCH v2 8/9] oe-selftest -r wic.Wic2 (non-runqemu) " Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-02 17:08 ` [RFC][PATCH v2 9/9] oe-selftest -r wic.Wic2 (runqemu) -> PASS (mostly) Trevor Woerner
2026-02-02 17:16 ` Patchtest results for " patchtest
2026-02-03 13:56 ` [OE-core] [RFC][PATCH v2 0/9] standalone wic Mathieu Dubois-Briand
2026-02-03 15:37 ` Trevor Woerner
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=20260202170800.4172778-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox