From 6d715aafecc1196b9549b6acaca9e8c7d4e034e8 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Wed, 2 Mar 2022 15:33:29 +0100 Subject: oeqa: selftest: overlayfs: add test for image with fstab entry (From OE-Core rev: 67f1959a46beec5edf133f2f8b02635feea7e599) Signed-off-by: Stefan Herbrechtsmeier Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/overlayfs.py | 82 +++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 27 deletions(-) (limited to 'meta/lib/oeqa') 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" 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 < ${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 + """ + + base_files_append = """ +do_install:append() { + cat <> ${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 + """ + + systemd_machine_unit_append = """ +SYSTEMD_SERVICE:${PN} += " \ + mnt-overlay.mount \ +" + +do_install:append() { + install -d ${D}${systemd_system_unitdir} + cat < ${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""" -- cgit v1.2.3-54-g00ecf