summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/rootfs-postcommands.bbclass38
-rw-r--r--meta/lib/oeqa/selftest/cases/overlayfs.py4
2 files changed, 31 insertions, 11 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index b63a5b90d3..7b92df69c5 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -372,25 +372,45 @@ rootfs_reproducible () {
fi
}
+# Perform a dumb check for unit existence, not its validity
python overlayfs_qa_check() {
from oe.overlayfs import mountUnitName
- # this is a dumb check for unit existence, not its validity
overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
imagepath = d.getVar("IMAGE_ROOTFS")
- searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"),
+ sysconfdir = d.getVar("sysconfdir")
+ searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
+ fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
+
+ if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
+ return
+
+ fstabDevices = []
+ if os.path.isfile(fstabpath):
+ with open(fstabpath, 'r') as f:
+ for line in f:
+ if line[0] == '#':
+ continue
+ path = line.split(maxsplit=2)
+ if len(path) > 2:
+ fstabDevices.append(path[1])
allUnitExist = True;
for mountPoint in overlayMountPoints:
- path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
- unit = mountUnitName(path)
+ mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
+ if mountPath in fstabDevices:
+ continue
+
+ mountUnit = mountUnitName(mountPath)
+ if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
+ for dirpath in searchpaths):
+ continue
- if not any(os.path.isfile(oe.path.join(dirpath, unit))
- for dirpath in searchpaths):
- bb.warn('Unit name %s not found in systemd unit directories' % unit)
- allUnitExist = False;
+ bb.warn('Mount path %s not found in fstat and unit %s not found '
+ 'in systemd unit directories' % (mountPath, mountUnit))
+ allUnitExist = False;
if not allUnitExist:
- bb.fatal('Not all mount units are installed by the BSP')
+ bb.fatal('Not all mount paths and units are installed in the image')
}
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index 82007fade7..79d36fa93c 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -61,9 +61,9 @@ DISTRO_FEATURES += "systemd overlayfs"
self.add_overlay_conf_to_machine()
res = bitbake('core-image-minimal', ignore_status=True)
- line = getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories")
+ line = getline(res, " Mount path /mnt/overlay not found in fstat and unit mnt-overlay.mount not found in systemd unit directories")
self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
- line = getline(res, "Not all mount units are installed by the BSP")
+ line = getline(res, "Not all mount paths and units are installed in the image")
self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
def test_mount_unit_not_set(self):