From: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>
---

 .../base-files/base-files_%.bbappend          |  2 +
 meta/lib/oeqa/selftest/cases/overlayfs.py     | 82 +++++++++++++------
 2 files changed, 57 insertions(+), 27 deletions(-)
 create mode 100644 meta-selftest/recipes-test/base-files/base-files_%.bbappend

diff --git a/meta-selftest/recipes-test/base-files/base-files_%.bbappend 
b/meta-selftest/recipes-test/base-files/base-files_%.bbappend
new file mode 100644
index 0000000000..205720982c
--- /dev/null
+++ b/meta-selftest/recipes-test/base-files/base-files_%.bbappend
@@ -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
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 <<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.herbrechtsme...@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.m...@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"""
 
-- 
2.30.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162613): 
https://lists.openembedded.org/g/openembedded-core/message/162613
Mute This Topic: https://lists.openembedded.org/mt/89502039/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to