Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] oe-selftest.wic: add PATH handling
Date: Mon, 28 Apr 2025 11:13:35 -0400	[thread overview]
Message-ID: <20250428151335.35671-1-twoerner@gmail.com> (raw)

The wic test_exclude_path_with_extra_space test succeeds on non-debian AB
workers. Add PATH handling so parted from the wic-tools can be found on
debian-based AB workers.

Fixes [YOCTO #15838]

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 meta/lib/oeqa/selftest/cases/wic.py | 63 ++++++++++++++++-------------
 1 file changed, 35 insertions(+), 28 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index d98af8713a19..60dce33911e9 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -538,35 +538,42 @@ part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoa
     def test_exclude_path_with_extra_space(self):
         """Test having --exclude-path with IMAGE_ROOTFS_EXTRA_SPACE. [Yocto #15555]"""
 
-        with NamedTemporaryFile("w", suffix=".wks") as wks:
-            wks.writelines(
-                ['bootloader --ptable gpt\n',
-                 'part /boot --size=100M --active --fstype=ext4 --label boot\n',
-                 'part /     --source rootfs      --fstype=ext4 --label root --exclude-path boot/\n'])
-            wks.flush()
-            config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\
-                     'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\
-                     'IMAGE_FSTYPES += "wic"\n'\
-                     'WKS_FILE = "%s"\n' % wks.name
-            self.append_config(config)
-            bitbake('core-image-minimal')
+        oldpath = os.environ['PATH']
+        os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
 
-        """
-        the output of "wic ls <image>.wic" will look something like:
-            Num     Start        End          Size      Fstype
-             1         17408    136332287    136314880  ext4
-             2     136332288    171464703     35132416  ext4
-        we are looking for the size of partition 2
-        i.e. in this case the number 35,132,416
-        without the fix the size will be around 85,403,648
-        with the fix the size should be around 799,960,064
-        """
-        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal')
-        deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
-        machine = bb_vars['MACHINE']
-        wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0]
-        size_of_root_partition = int(runCmd("wic ls %s" % wicout).output.split('\n')[2].split()[3])
-        self.assertGreater(size_of_root_partition, 500000000)
+        try:
+            with NamedTemporaryFile("w", suffix=".wks") as wks:
+                wks.writelines(
+                    ['bootloader --ptable gpt\n',
+                     'part /boot --size=100M --active --fstype=ext4 --label boot\n',
+                     'part /     --source rootfs      --fstype=ext4 --label root --exclude-path boot/\n'])
+                wks.flush()
+                config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\
+                         'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\
+                         'IMAGE_FSTYPES += "wic"\n'\
+                         'WKS_FILE = "%s"\n' % wks.name
+                self.append_config(config)
+                bitbake('core-image-minimal')
+
+            """
+            the output of "wic ls <image>.wic" will look something like:
+                Num     Start        End          Size      Fstype
+                 1         17408    136332287    136314880  ext4
+                 2     136332288    171464703     35132416  ext4
+            we are looking for the size of partition 2
+            i.e. in this case the number 35,132,416
+            without the fix the size will be around 85,403,648
+            with the fix the size should be around 799,960,064
+            """
+            bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal')
+            deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
+            machine = bb_vars['MACHINE']
+            wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0]
+            size_of_root_partition = int(runCmd("wic ls %s" % wicout).output.split('\n')[2].split()[3])
+            self.assertGreater(size_of_root_partition, 500000000)
+
+        finally:
+            os.environ['PATH'] = oldpath
 
     def test_include_path(self):
         """Test --include-path wks option."""
-- 
2.44.0.501.g19981daefd7c



                 reply	other threads:[~2025-04-28 15:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250428151335.35671-1-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