@@ -446,8 +446,9 @@ class Wic(WicTestCase):
wks.write("""
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
-part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
- % (rootfs_dir, rootfs_dir))
+part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr
+part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoami --rootfs-dir %s/usr"""
+ % (rootfs_dir, rootfs_dir, rootfs_dir))
runCmd("wic create %s -e core-image-minimal -o %s" \
% (wks_file, self.resultdir))
@@ -466,9 +467,9 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
# 1:0.00MiB:200MiB:200MiB:ext4::;\n
partlns = res.output.splitlines()[2:]
- self.assertEqual(3, len(partlns))
+ self.assertEqual(4, len(partlns))
- for part in [1, 2, 3]:
+ for part in [1, 2, 3, 4]:
part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
partln = partlns[part-1].split(":")
self.assertEqual(7, len(partln))
@@ -510,7 +511,24 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
self.assertIn("..", files)
self.assertEqual(2, len(files))
- for part in [1, 2, 3]:
+ # Partition 4, should contain the same as partition 2, including the bin
+ # directory, but not whoami (a symlink to busybox.nosuid) inside it.
+ res = runCmd("debugfs -R 'ls -p' %s" % \
+ os.path.join(self.resultdir, "selftest_img.part4"), stderr=subprocess.PIPE)
+ files = extract_files(res.output)
+ self.assertNotIn("etc", files)
+ self.assertNotIn("usr", files)
+ self.assertIn("share", files)
+ self.assertIn("bin", files)
+ res = runCmd("debugfs -R 'ls -p bin' %s" % \
+ os.path.join(self.resultdir, "selftest_img.part4"), stderr=subprocess.PIPE)
+ files = extract_files(res.output)
+ self.assertIn(".", files)
+ self.assertIn("..", files)
+ self.assertIn("who", files)
+ self.assertNotIn("whoami", files)
+
+ for part in [1, 2, 3, 4]:
part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
os.remove(part_file)
Add test to check if --exclude-path option can exclude symlinks. This test validates commit[1]. Test result: $ oe-selftest -r wic.Wic.test_exclude_path 2025-04-03 15:11:25,211 - oe-selftest - INFO - meta-selftest layer not found in BBLAYERS, adding it 2025-04-03 15:11:30,016 - oe-selftest - INFO - Adding layer libraries: 2025-04-03 15:11:30,017 - oe-selftest - INFO - /buildarea/poky/meta/lib 2025-04-03 15:11:30,017 - oe-selftest - INFO - /buildarea/poky/meta-yocto-bsp/lib 2025-04-03 15:11:30,017 - oe-selftest - INFO - /buildarea/poky/meta-selftest/lib 2025-04-03 15:11:30,019 - oe-selftest - INFO - Checking base configuration is valid/parsable NOTE: Starting bitbake server... 2025-04-03 15:11:31,652 - oe-selftest - INFO - Adding: "include selftest.inc" in /buildarea/poky/build-st/conf/local.conf 2025-04-03 15:11:31,653 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf 2025-04-03 15:11:31,653 - oe-selftest - INFO - test_exclude_path (wic.Wic) 2025-04-03 15:43:11,341 - oe-selftest - INFO - ... ok 2025-04-03 15:43:11,341 - oe-selftest - INFO - ---------------------------------------------------------------------- 2025-04-03 15:43:11,342 - oe-selftest - INFO - Ran 1 test in 1899.900s 2025-04-03 15:43:11,342 - oe-selftest - INFO - OK 2025-04-03 15:43:14,834 - oe-selftest - INFO - RESULTS: 2025-04-03 15:43:14,835 - oe-selftest - INFO - RESULTS - wic.Wic.test_exclude_path: PASSED (1899.69s) 2025-04-03 15:43:14,836 - oe-selftest - INFO - SUMMARY: 2025-04-03 15:43:14,836 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 1899.900s 2025-04-03 15:43:14,836 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0) [1] https://git.openembedded.org/openembedded-core/commit/?id=42e829ac1e9d74646b6dfb327b18b15f6b0df60b Signed-off-by: Yi Zhao <yi.zhao@windriver.com> --- meta/lib/oeqa/selftest/cases/wic.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)