mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
oeqa/selftest: extend overlayfs test
Test that overlayfs.bbclass generates one systemd unit, that applications can set dependencies on, and that this unit mounts all required overlays (From OE-Core rev: b0e335268de78cfe163f3cfdc0209ae26309fc78) Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
57979576f3
commit
39f3274dd5
@@ -149,15 +149,54 @@ WantedBy=multi-user.target
|
|||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
overlayfs_recipe_append = """
|
||||||
|
OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/another-overlay-mount"
|
||||||
|
|
||||||
|
SYSTEMD_SERVICE:${PN} += " \
|
||||||
|
my-application.service \
|
||||||
|
"
|
||||||
|
|
||||||
|
do_install:append() {
|
||||||
|
install -d ${D}${systemd_system_unitdir}
|
||||||
|
cat <<EOT > ${D}${systemd_system_unitdir}/my-application.service
|
||||||
|
[Unit]
|
||||||
|
Description=Sample application start-up unit
|
||||||
|
After=overlayfs-user-overlays.service
|
||||||
|
Requires=overlayfs-user-overlays.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/bin/true
|
||||||
|
RemainAfterExit=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOT
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.write_config(config)
|
self.write_config(config)
|
||||||
self.add_overlay_conf_to_machine()
|
self.add_overlay_conf_to_machine()
|
||||||
self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append)
|
self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append)
|
||||||
|
self.write_recipeinc('overlayfs-user', overlayfs_recipe_append)
|
||||||
|
|
||||||
bitbake('core-image-minimal')
|
bitbake('core-image-minimal')
|
||||||
|
|
||||||
with runqemu('core-image-minimal') as qemu:
|
with runqemu('core-image-minimal') as qemu:
|
||||||
|
# Check that application service started
|
||||||
|
status, output = qemu.run_serial("systemctl status my-application")
|
||||||
|
self.assertTrue("active (exited)" in output, msg=output)
|
||||||
|
|
||||||
|
# Check that overlay mounts are dependencies of our application unit
|
||||||
|
status, output = qemu.run_serial("systemctl list-dependencies my-application")
|
||||||
|
self.assertTrue("overlayfs-user-overlays.service" in output, msg=output)
|
||||||
|
|
||||||
|
status, output = qemu.run_serial("systemctl list-dependencies overlayfs-user-overlays")
|
||||||
|
self.assertTrue("usr-share-another\\x2doverlay\\x2dmount.mount" in output, msg=output)
|
||||||
|
self.assertTrue("usr-share-my\\x2dapplication.mount" in output, msg=output)
|
||||||
|
|
||||||
# Check that we have /mnt/overlay fs mounted as tmpfs and
|
# Check that we have /mnt/overlay fs mounted as tmpfs and
|
||||||
# /usr/share/my-application as an overlay (see overlayfs-user recipe)
|
# /usr/share/my-application as an overlay (see overlayfs-user recipe)
|
||||||
status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
|
status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
|
||||||
@@ -167,3 +206,6 @@ EOT
|
|||||||
|
|
||||||
line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
|
line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
|
||||||
self.assertTrue(line and line.startswith("overlay"), msg=output)
|
self.assertTrue(line and line.startswith("overlay"), msg=output)
|
||||||
|
|
||||||
|
line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount")
|
||||||
|
self.assertTrue(line and line.startswith("overlay"), msg=output)
|
||||||
|
|||||||
Reference in New Issue
Block a user