diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index bff3842305..bc99673d0d 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1680,0 +1681,4 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
+ oldpath = os.environ['PATH']
+ os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
+
+ try:
@@ -1696,0 +1701,3 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
+ finally:
+ os.environ['PATH'] = oldpath
+
[0]: https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2456
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
meta/lib/oeqa/selftest/cases/wic.py | 31 ++++++++++++++++++-----------
1 file changed, 19 insertions(+), 12 deletions(-)
@@ -1678,21 +1678,28 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
testfile.write("test")
testfile.close()
- with NamedTemporaryFile("w", suffix=".wks") as wks:
- wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n',
- 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',
- 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n'])
- wks.flush()
- _, wicimg = self._get_wic(wks.name)
+ oldpath = os.environ['PATH']
+ os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
+
+ try:
+ with NamedTemporaryFile("w", suffix=".wks") as wks:
+ wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n',
+ 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',
+ 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n'])
+ wks.flush()
+ _, wicimg = self._get_wic(wks.name)
- result = runCmd("wic ls %s | wc -l" % wicimg)
- self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output)
+ result = runCmd("wic ls %s | wc -l" % wicimg)
+ self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output)
- for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]):
- result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file))
- self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part))
+ for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]):
+ result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file))
+ self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part))
- self.remove_config(config)
+ self.remove_config(config)
+
+ finally:
+ os.environ['PATH'] = oldpath
def test_fs_types(self):
"""Test filesystem types for empty and not empty partitions"""
From: Yoann Congal <yoann.congal@smile.fr> Without importing PATH from the wic-tools recipes, the build host PATH is used and this test may fail depending on tools (parted, dumpe2fs, ...) availability. This triggers build faillure on AB (e.g. [0]) To fix this, import PATH from wic-tools and ensure the original environment is restored after. Since this indent a block of code into a try/finally block, here is the