diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2022-03-02 15:33:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-04 17:14:15 +0000 |
commit | 6d715aafecc1196b9549b6acaca9e8c7d4e034e8 (patch) | |
tree | 332eac313bfaf71cfc07f95650ebc2d832d92a6a /meta/lib/oeqa | |
parent | 2126584d61c1d94c88cceb4f5bff14d8ec60cb91 (diff) | |
download | poky-6d715aafecc1196b9549b6acaca9e8c7d4e034e8.tar.gz |
oeqa: selftest: overlayfs: add test for image with fstab entry
(From OE-Core rev: 67f1959a46beec5edf133f2f8b02635feea7e599)
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/overlayfs.py | 82 |
1 files changed, 55 insertions, 27 deletions
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index 79d36fa93c..56ae48ce64 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py | |||
@@ -107,7 +107,7 @@ OVERLAYFS_MOUNT_POINT[usr-share-overlay] = "/usr/share/overlay" | |||
107 | line = getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration") | 107 | line = getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration") |
108 | self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output) | 108 | self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output) |
109 | 109 | ||
110 | def test_correct_image(self): | 110 | def _test_correct_image(self, recipe, data): |
111 | """ | 111 | """ |
112 | Summary: Check that we can create an image when all parameters are | 112 | Summary: Check that we can create an image when all parameters are |
113 | set correctly | 113 | set correctly |
@@ -126,31 +126,6 @@ VIRTUAL-RUNTIME_init_manager = "systemd" | |||
126 | KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc" | 126 | KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc" |
127 | """ | 127 | """ |
128 | 128 | ||
129 | systemd_machine_unit_append = """ | ||
130 | SYSTEMD_SERVICE:${PN} += " \ | ||
131 | mnt-overlay.mount \ | ||
132 | " | ||
133 | |||
134 | do_install:append() { | ||
135 | install -d ${D}${systemd_system_unitdir} | ||
136 | cat <<EOT > ${D}${systemd_system_unitdir}/mnt-overlay.mount | ||
137 | [Unit] | ||
138 | Description=Tmpfs directory | ||
139 | DefaultDependencies=no | ||
140 | |||
141 | [Mount] | ||
142 | What=tmpfs | ||
143 | Where=/mnt/overlay | ||
144 | Type=tmpfs | ||
145 | Options=mode=1777,strictatime,nosuid,nodev | ||
146 | |||
147 | [Install] | ||
148 | WantedBy=multi-user.target | ||
149 | EOT | ||
150 | } | ||
151 | |||
152 | """ | ||
153 | |||
154 | overlayfs_recipe_append = """ | 129 | overlayfs_recipe_append = """ |
155 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/another-overlay-mount" | 130 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/another-overlay-mount" |
156 | 131 | ||
@@ -179,7 +154,7 @@ EOT | |||
179 | 154 | ||
180 | self.write_config(config) | 155 | self.write_config(config) |
181 | self.add_overlay_conf_to_machine() | 156 | self.add_overlay_conf_to_machine() |
182 | self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append) | 157 | self.write_recipeinc(recipe, data) |
183 | self.write_recipeinc('overlayfs-user', overlayfs_recipe_append) | 158 | self.write_recipeinc('overlayfs-user', overlayfs_recipe_append) |
184 | 159 | ||
185 | bitbake('core-image-minimal') | 160 | bitbake('core-image-minimal') |
@@ -210,6 +185,59 @@ EOT | |||
210 | line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount") | 185 | line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount") |
211 | self.assertTrue(line and line.startswith("overlay"), msg=output) | 186 | self.assertTrue(line and line.startswith("overlay"), msg=output) |
212 | 187 | ||
188 | def test_correct_image_fstab(self): | ||
189 | """ | ||
190 | Summary: Check that we can create an image when all parameters are | ||
191 | set correctly via fstab | ||
192 | Expected: Image is created successfully | ||
193 | Author: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | ||
194 | """ | ||
195 | |||
196 | base_files_append = """ | ||
197 | do_install:append() { | ||
198 | cat <<EOT >> ${D}${sysconfdir}/fstab | ||
199 | tmpfs /mnt/overlay tmpfs mode=1777,strictatime,nosuid,nodev 0 0 | ||
200 | EOT | ||
201 | } | ||
202 | """ | ||
203 | |||
204 | self._test_correct_image('base-files', base_files_append) | ||
205 | |||
206 | def test_correct_image_unit(self): | ||
207 | """ | ||
208 | Summary: Check that we can create an image when all parameters are | ||
209 | set correctly via mount unit | ||
210 | Expected: Image is created successfully | ||
211 | Author: Vyacheslav Yurkov <uvv.mail@gmail.com> | ||
212 | """ | ||
213 | |||
214 | systemd_machine_unit_append = """ | ||
215 | SYSTEMD_SERVICE:${PN} += " \ | ||
216 | mnt-overlay.mount \ | ||
217 | " | ||
218 | |||
219 | do_install:append() { | ||
220 | install -d ${D}${systemd_system_unitdir} | ||
221 | cat <<EOT > ${D}${systemd_system_unitdir}/mnt-overlay.mount | ||
222 | [Unit] | ||
223 | Description=Tmpfs directory | ||
224 | DefaultDependencies=no | ||
225 | |||
226 | [Mount] | ||
227 | What=tmpfs | ||
228 | Where=/mnt/overlay | ||
229 | Type=tmpfs | ||
230 | Options=mode=1777,strictatime,nosuid,nodev | ||
231 | |||
232 | [Install] | ||
233 | WantedBy=multi-user.target | ||
234 | EOT | ||
235 | } | ||
236 | |||
237 | """ | ||
238 | |||
239 | self._test_correct_image('systemd-machine-units', systemd_machine_unit_append) | ||
240 | |||
213 | class OverlayFSEtcRunTimeTests(OESelftestTestCase): | 241 | class OverlayFSEtcRunTimeTests(OESelftestTestCase): |
214 | """overlayfs-etc class tests""" | 242 | """overlayfs-etc class tests""" |
215 | 243 | ||