mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
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>
This commit is contained in:
parent
2126584d61
commit
6d715aafec
|
@ -0,0 +1,2 @@
|
|||
# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
|
||||
include test_recipe.inc
|
|
@ -107,7 +107,7 @@ OVERLAYFS_MOUNT_POINT[usr-share-overlay] = "/usr/share/overlay"
|
|||
line = getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration")
|
||||
self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output)
|
||||
|
||||
def test_correct_image(self):
|
||||
def _test_correct_image(self, recipe, data):
|
||||
"""
|
||||
Summary: Check that we can create an image when all parameters are
|
||||
set correctly
|
||||
|
@ -124,31 +124,6 @@ VIRTUAL-RUNTIME_init_manager = "systemd"
|
|||
|
||||
# enable overlayfs in the kernel
|
||||
KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc"
|
||||
"""
|
||||
|
||||
systemd_machine_unit_append = """
|
||||
SYSTEMD_SERVICE:${PN} += " \
|
||||
mnt-overlay.mount \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
cat <<EOT > ${D}${systemd_system_unitdir}/mnt-overlay.mount
|
||||
[Unit]
|
||||
Description=Tmpfs directory
|
||||
DefaultDependencies=no
|
||||
|
||||
[Mount]
|
||||
What=tmpfs
|
||||
Where=/mnt/overlay
|
||||
Type=tmpfs
|
||||
Options=mode=1777,strictatime,nosuid,nodev
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOT
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
overlayfs_recipe_append = """
|
||||
|
@ -179,7 +154,7 @@ EOT
|
|||
|
||||
self.write_config(config)
|
||||
self.add_overlay_conf_to_machine()
|
||||
self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append)
|
||||
self.write_recipeinc(recipe, data)
|
||||
self.write_recipeinc('overlayfs-user', overlayfs_recipe_append)
|
||||
|
||||
bitbake('core-image-minimal')
|
||||
|
@ -210,6 +185,59 @@ EOT
|
|||
line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount")
|
||||
self.assertTrue(line and line.startswith("overlay"), msg=output)
|
||||
|
||||
def test_correct_image_fstab(self):
|
||||
"""
|
||||
Summary: Check that we can create an image when all parameters are
|
||||
set correctly via fstab
|
||||
Expected: Image is created successfully
|
||||
Author: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
|
||||
"""
|
||||
|
||||
base_files_append = """
|
||||
do_install:append() {
|
||||
cat <<EOT >> ${D}${sysconfdir}/fstab
|
||||
tmpfs /mnt/overlay tmpfs mode=1777,strictatime,nosuid,nodev 0 0
|
||||
EOT
|
||||
}
|
||||
"""
|
||||
|
||||
self._test_correct_image('base-files', base_files_append)
|
||||
|
||||
def test_correct_image_unit(self):
|
||||
"""
|
||||
Summary: Check that we can create an image when all parameters are
|
||||
set correctly via mount unit
|
||||
Expected: Image is created successfully
|
||||
Author: Vyacheslav Yurkov <uvv.mail@gmail.com>
|
||||
"""
|
||||
|
||||
systemd_machine_unit_append = """
|
||||
SYSTEMD_SERVICE:${PN} += " \
|
||||
mnt-overlay.mount \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
cat <<EOT > ${D}${systemd_system_unitdir}/mnt-overlay.mount
|
||||
[Unit]
|
||||
Description=Tmpfs directory
|
||||
DefaultDependencies=no
|
||||
|
||||
[Mount]
|
||||
What=tmpfs
|
||||
Where=/mnt/overlay
|
||||
Type=tmpfs
|
||||
Options=mode=1777,strictatime,nosuid,nodev
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOT
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
self._test_correct_image('systemd-machine-units', systemd_machine_unit_append)
|
||||
|
||||
class OverlayFSEtcRunTimeTests(OESelftestTestCase):
|
||||
"""overlayfs-etc class tests"""
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user