From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>,
Mark Hatle <mark.hatle@kernel.crashing.org>
Subject: [PATCH v9 2/5] oe-selftest/cases/wic.py: update WicTestCase
Date: Fri, 3 Apr 2026 14:35:38 -0400 [thread overview]
Message-ID: <20260403183541.2631883-3-twoerner@gmail.com> (raw)
In-Reply-To: <20260403183541.2631883-1-twoerner@gmail.com>
The wic oe-selftest defines its own class (WicTestCase) for handling
setup, teardown, and various other pieces needed to run the individual
wic oe-selftests. As part of oe-core, the wic.CLITests do not need
setup and teardown. However, once wic is no longer part of oe-core, the
oe-selftests will need to know where to find wic that comes from a
recipe. Update PATH so wic will be available.
NOTE: this patch is in preparation for removing wic from oe-core
the wic oe-selftests work fine with this patch being added now
AI-Generated: codex/gpt-5.4 (high)
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:
- provide a smaller change to the wic test bbclass in order to allow
the oe-selftests to work, this patch only updates the PATH
changes in v8:
- (skipped, sector-size cmdline arg upstreamed)
changes in v7:
- (none)
changes in v6:
- (none)
changes in v5:
- rebase with master
- split patch set back out into smaller patches
changes in v4:
- (skipped)
changes in v3:
- squashed into one large patch
changes in v2:
- (none)
---
meta/lib/oeqa/selftest/cases/wic.py | 36 ++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index f627f7099641..791d265a5ee7 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -57,10 +57,12 @@ class WicTestCase(OESelftestTestCase):
image_is_ready = False
wicenv_cache = {}
+ wic_bindir = None
def setUpLocal(self):
"""This code is executed before each test method."""
self.resultdir = os.path.join(self.builddir, "wic-tmp")
+ self._old_path = os.environ.get('PATH')
super(WicTestCase, self).setUpLocal()
# Do this here instead of in setUpClass as the base setUp does some
@@ -72,13 +74,45 @@ class WicTestCase(OESelftestTestCase):
bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils')
WicTestCase.image_is_ready = True
+
+ os.environ['PATH'] = self._get_wic_path()
rmtree(self.resultdir, ignore_errors=True)
def tearDownLocal(self):
"""Remove resultdir as it may contain images."""
+ if self._old_path is None:
+ os.environ.pop('PATH', None)
+ else:
+ os.environ['PATH'] = self._old_path
rmtree(self.resultdir, ignore_errors=True)
super(WicTestCase, self).tearDownLocal()
+ def _get_wic_path(self):
+ if WicTestCase.wic_bindir is None:
+ search_paths = [
+ os.path.join(self.td['COREBASE'], 'scripts'),
+ os.path.join(get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools'), 'usr', 'bin'),
+ ]
+
+ for bindir in search_paths:
+ if os.path.exists(os.path.join(bindir, 'wic')):
+ WicTestCase.wic_bindir = bindir
+ break
+
+ if WicTestCase.wic_bindir is None:
+ self.fail("Unable to find the wic binary in %s" % ', '.join(search_paths))
+
+ path_entries = []
+ for path_group in (
+ [WicTestCase.wic_bindir],
+ (get_bb_var("PATH", "wic-tools") or '').split(':'),
+ (self._old_path or '').split(':')):
+ for entry in path_group:
+ if entry and entry not in path_entries:
+ path_entries.append(entry)
+
+ return ':'.join(path_entries)
+
def _get_image_env_path(self, image):
"""Generate and obtain the path to <image>.env"""
if image not in WicTestCase.wicenv_cache:
@@ -88,7 +122,7 @@ class WicTestCase(OESelftestTestCase):
WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
return WicTestCase.wicenv_cache[image]
-class CLITests(OESelftestTestCase):
+class CLITests(WicTestCase):
def test_version(self):
"""Test wic --version"""
runCmd('wic --version')
--
2.51.0
next prev parent reply other threads:[~2026-04-03 18:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 18:35 [PATCH v9 0/5] standalone wic Trevor Woerner
2026-04-03 18:35 ` [PATCH v9 1/5] wic: add recipe Trevor Woerner
2026-04-07 15:48 ` [OE-core] " Yoann Congal
2026-04-03 18:35 ` Trevor Woerner [this message]
2026-04-03 18:35 ` [PATCH v9 3/5] selftest/cases/wic.py: remove test_sparse_copy Trevor Woerner
2026-04-03 18:35 ` [PATCH v9 4/5] wic: move canned *wks files Trevor Woerner
2026-04-03 21:13 ` [OE-core] " Richard Purdie
2026-04-03 22:23 ` Trevor Woerner
2026-04-04 7:27 ` Richard Purdie
2026-04-04 15:46 ` Trevor Woerner
2026-04-04 18:19 ` Trevor Woerner
2026-04-04 18:36 ` Richard Purdie
2026-04-04 20:38 ` Trevor Woerner
2026-04-05 9:17 ` Richard Purdie
2026-04-05 12:04 ` Trevor Woerner
2026-04-05 14:16 ` Richard Purdie
2026-04-05 15:22 ` Trevor Woerner
[not found] ` <18A2F52EC877AF22.657799@lists.openembedded.org>
2026-04-03 21:37 ` Richard Purdie
2026-04-03 18:35 ` [PATCH v9 5/5] wic: remove to standalone repository 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=20260403183541.2631883-3-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=bruce.ashfield@gmail.com \
--cc=mark.hatle@kernel.crashing.org \
--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