diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/overlayfs.py | 42 |
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 = """ | ||
| 155 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/another-overlay-mount" | ||
| 156 | |||
| 157 | SYSTEMD_SERVICE:${PN} += " \ | ||
| 158 | my-application.service \ | ||
| 159 | " | ||
| 160 | |||
| 161 | do_install:append() { | ||
| 162 | install -d ${D}${systemd_system_unitdir} | ||
| 163 | cat <<EOT > ${D}${systemd_system_unitdir}/my-application.service | ||
| 164 | [Unit] | ||
| 165 | Description=Sample application start-up unit | ||
| 166 | After=overlayfs-user-overlays.service | ||
| 167 | Requires=overlayfs-user-overlays.service | ||
| 168 | |||
| 169 | [Service] | ||
| 170 | Type=oneshot | ||
| 171 | ExecStart=/bin/true | ||
| 172 | RemainAfterExit=true | ||
| 173 | |||
| 174 | [Install] | ||
| 175 | WantedBy=multi-user.target | ||
| 176 | EOT | ||
| 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) | ||
