diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2025-10-03 23:12:48 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-06 23:16:00 +0100 |
| commit | 9ef953f10d9f83b69bd3187f0690f8b758119ba4 (patch) | |
| tree | 5de38b118db37195d0546cd248316be2ad86aefa /meta/lib/oeqa | |
| parent | 82eb9a0c365c208f85796ee3a008a8827cfa0c77 (diff) | |
| download | poky-9ef953f10d9f83b69bd3187f0690f8b758119ba4.tar.gz | |
oeqa/selftest/wic: fix PATH for wic.Wic2.test_extra_partition_plugin
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
diff ignoring white spaces change:
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
(From OE-Core rev: 9dfd4f44d4f40e7926dc88cb564baa2345c2a24f)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 78de2fcfd0..bb4ac23ebf 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
| @@ -1678,21 +1678,28 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" | |||
| 1678 | testfile.write("test") | 1678 | testfile.write("test") |
| 1679 | testfile.close() | 1679 | testfile.close() |
| 1680 | 1680 | ||
| 1681 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 1681 | oldpath = os.environ['PATH'] |
| 1682 | wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n', | 1682 | os.environ['PATH'] = get_bb_var("PATH", "wic-tools") |
| 1683 | 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', | 1683 | |
| 1684 | 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n']) | 1684 | try: |
| 1685 | wks.flush() | 1685 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
| 1686 | _, wicimg = self._get_wic(wks.name) | 1686 | wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n', |
| 1687 | 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', | ||
| 1688 | 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n']) | ||
| 1689 | wks.flush() | ||
| 1690 | _, wicimg = self._get_wic(wks.name) | ||
| 1687 | 1691 | ||
| 1688 | result = runCmd("wic ls %s | wc -l" % wicimg) | 1692 | result = runCmd("wic ls %s | wc -l" % wicimg) |
| 1689 | self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output) | 1693 | self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output) |
| 1690 | 1694 | ||
| 1691 | for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]): | 1695 | for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]): |
| 1692 | result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file)) | 1696 | result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file)) |
| 1693 | self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part)) | 1697 | self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part)) |
| 1694 | 1698 | ||
| 1695 | self.remove_config(config) | 1699 | self.remove_config(config) |
| 1700 | |||
| 1701 | finally: | ||
| 1702 | os.environ['PATH'] = oldpath | ||
| 1696 | 1703 | ||
| 1697 | def test_fs_types(self): | 1704 | def test_fs_types(self): |
| 1698 | """Test filesystem types for empty and not empty partitions""" | 1705 | """Test filesystem types for empty and not empty partitions""" |
