summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorVyacheslav Yurkov <uvv.mail@gmail.com>2021-10-17 10:08:58 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-30 22:31:52 +0100
commit39f3274dd55b7501f7cbb83e91fe190004f3d3fa (patch)
tree70ee137fd531dda745c0ee782e2245cc9b180a3c /meta/lib
parent57979576f39f0d25ed47dd739d88720a4e4214b5 (diff)
downloadpoky-39f3274dd55b7501f7cbb83e91fe190004f3d3fa.tar.gz
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>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/overlayfs.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index f0c9860b48..84242a1605 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -151,13 +151,52 @@ EOT
151 151
152""" 152"""
153 153
154 overlayfs_recipe_append = """
155OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/another-overlay-mount"
156
157SYSTEMD_SERVICE:${PN} += " \
158 my-application.service \
159"
160
161do_install:append() {
162 install -d ${D}${systemd_system_unitdir}
163 cat <<EOT > ${D}${systemd_system_unitdir}/my-application.service
164[Unit]
165Description=Sample application start-up unit
166After=overlayfs-user-overlays.service
167Requires=overlayfs-user-overlays.service
168
169[Service]
170Type=oneshot
171ExecStart=/bin/true
172RemainAfterExit=true
173
174[Install]
175WantedBy=multi-user.target
176EOT
177}
178"""
179
154 self.write_config(config) 180 self.write_config(config)
155 self.add_overlay_conf_to_machine() 181 self.add_overlay_conf_to_machine()
156 self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append) 182 self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append)
183 self.write_recipeinc('overlayfs-user', overlayfs_recipe_append)
157 184
158 bitbake('core-image-minimal') 185 bitbake('core-image-minimal')
159 186
160 with runqemu('core-image-minimal') as qemu: 187 with runqemu('core-image-minimal') as qemu:
188 # Check that application service started
189 status, output = qemu.run_serial("systemctl status my-application")
190 self.assertTrue("active (exited)" in output, msg=output)
191
192 # Check that overlay mounts are dependencies of our application unit
193 status, output = qemu.run_serial("systemctl list-dependencies my-application")
194 self.assertTrue("overlayfs-user-overlays.service" in output, msg=output)
195
196 status, output = qemu.run_serial("systemctl list-dependencies overlayfs-user-overlays")
197 self.assertTrue("usr-share-another\\x2doverlay\\x2dmount.mount" in output, msg=output)
198 self.assertTrue("usr-share-my\\x2dapplication.mount" in output, msg=output)
199
161 # Check that we have /mnt/overlay fs mounted as tmpfs and 200 # Check that we have /mnt/overlay fs mounted as tmpfs and
162 # /usr/share/my-application as an overlay (see overlayfs-user recipe) 201 # /usr/share/my-application as an overlay (see overlayfs-user recipe)
163 status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay") 202 status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
@@ -167,3 +206,6 @@ EOT
167 206
168 line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application") 207 line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
169 self.assertTrue(line and line.startswith("overlay"), msg=output) 208 self.assertTrue(line and line.startswith("overlay"), msg=output)
209
210 line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount")
211 self.assertTrue(line and line.startswith("overlay"), msg=output)