Skip to contentSkip to conversation

oeqa/selftest/overlayfs: test read-only rootfs

PATCH Vyacheslav Yurkov 2 participants 2 messages Mar 26, 2024 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Just checking if there's any feedback for the patch or something that stops it from being merged.

Slava

Quoted 116 lines · Vyacheslav Yurkov via lists.openembedded.org

From: Baruch Siach <[email protected]>

Use the read-only squashfs filesystem to test the read-only case.

---
  meta-selftest/wic/overlayfs_etc.wks.in    |  4 +--
  meta/lib/oeqa/selftest/cases/overlayfs.py | 34 +++++++++++++++++++----
  2 files changed, 30 insertions(+), 8 deletions(-)
meta-selftest/wic/overlayfs_etc.wks.in +2 -2
index 1e1e5836e7..066cd35b15 100644
@@ -1,4 +1,4 @@
  part /boot --active --source bootimg-biosplusefi --ondisk sda --sourceparams="loader=grub-efi" --align 1024
-part / --source rootfs --ondisk sda --fstype=ext4 --use-uuid --align 1024
+part / --source rootfs --ondisk sda --fstype=${OVERLAYFS_ROOTFS_TYPE} --use-uuid --align 1024
  part --ondisk sda --fstype=ext4 --size=5 --align 1024
-bootloader --ptable gpt --timeout=1 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0 ${OVERLAYFS_INIT_OPTION}"
+bootloader --ptable gpt --timeout=1 --append="rootfstype=${OVERLAYFS_ROOTFS_TYPE} console=ttyS0,115200 console=tty0 ${OVERLAYFS_INIT_OPTION}"
meta/lib/oeqa/selftest/cases/overlayfs.py +28 -7
index cd0dc60c64..e31063567b 100644
@@ -353,6 +353,7 @@ EXTRA_IMAGE_FEATURES += "read-only-rootfs"
  # Image configuration for overlayfs-etc
  OVERLAYFS_ETC_MOUNT_POINT = "/data"
  OVERLAYFS_ETC_DEVICE = "/dev/sda3"
+OVERLAYFS_ROOTFS_TYPE = "ext4"
  """
 
          self.write_config(config)
@@ -367,13 +368,17 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3"
 
      @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
      def test_sbin_init_preinit(self):
-        self.run_sbin_init(False)
+        self.run_sbin_init(False, "ext4")
 
      @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
      def test_sbin_init_original(self):
-        self.run_sbin_init(True)
+        self.run_sbin_init(True, "ext4")
 
-    def run_sbin_init(self, origInit):
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
+    def test_sbin_init_read_only(self):
+        self.run_sbin_init(True, "squashfs")
+
+    def run_sbin_init(self, origInit, rootfsType):
          """
          Summary:   Confirm we can replace original init and mount overlay on top of /etc
          Expected:  Image is created successfully and /etc is mounted as an overlay
@@ -384,7 +389,9 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3"
 
          args = {
              'OVERLAYFS_INIT_OPTION': "" if origInit else "init=/sbin/preinit",
-            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True)
+            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True),
+            'OVERLAYFS_ROOTFS_TYPE': rootfsType,
+            'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': int(rootfsType == "ext4")
          }
 
          self.write_config(config.format(**args))
@@ -437,7 +444,9 @@ IMAGE_INSTALL:append = " overlayfs-user"
 
          args = {
              'OVERLAYFS_INIT_OPTION': "",
-            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1
+            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1,
+            'OVERLAYFS_ROOTFS_TYPE': "ext4",
+            'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1
          }
 
          self.write_config(config.format(**args))
@@ -463,10 +472,14 @@ IMAGE_INSTALL:append = " overlayfs-user"
  INIT_MANAGER = "systemd"
 
  # enable overlayfs in the kernel
-KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc"
+KERNEL_EXTRA_FEATURES:append = " \
+    features/overlayfs/overlayfs.scc \
+    cfg/fs/squashfs.scc"
 
  IMAGE_FSTYPES += "wic"
  OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}"
+OVERLAYFS_ROOTFS_TYPE = "{OVERLAYFS_ROOTFS_TYPE}"
+OVERLAYFS_ETC_CREATE_MOUNT_DIRS = "{OVERLAYFS_ETC_CREATE_MOUNT_DIRS}"
  WKS_FILE = "overlayfs_etc.wks.in"
 
  EXTRA_IMAGE_FEATURES += "read-only-rootfs"
@@ -477,4 +490,13 @@ OVERLAYFS_ETC_MOUNT_POINT = "/data"
  OVERLAYFS_ETC_FSTYPE = "ext4"
  OVERLAYFS_ETC_DEVICE = "/dev/sda3"
  OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}"
+
+ROOTFS_POSTPROCESS_COMMAND += "{OVERLAYFS_ROOTFS_TYPE}_rootfs"
+
+ext4_rootfs() {{
+}}
+
+squashfs_rootfs() {{
+    mkdir -p ${{IMAGE_ROOTFS}}/data
+}}
  """
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#197270): https://lists.openembedded.org/g/openembedded-core/message/197270
Mute This Topic: https://lists.openembedded.org/mt/104989652/4455192
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Feature freeze perhaps? The patch is in abelloni/master-next and will be handled later, possibly after the release is out. It's better to not send it during the freeze period though to avoid adding to the backlog.

Alex

Quoted 127 lines · Vyacheslav Yurkov

Just checking if there's any feedback for the patch or something that stops it from being merged.

Slava

Quoted 100 lines · Vyacheslav Yurkov via lists.openembedded.org

From: Baruch Siach <[email protected]>

Use the read-only squashfs filesystem to test the read-only case.

---
  meta-selftest/wic/overlayfs_etc.wks.in    |  4 +--
  meta/lib/oeqa/selftest/cases/overlayfs.py | 34 +++++++++++++++++++----
  2 files changed, 30 insertions(+), 8 deletions(-)
meta-selftest/wic/overlayfs_etc.wks.in +2 -2
index 1e1e5836e7..066cd35b15 100644
@@ -1,4 +1,4 @@
  part /boot --active --source bootimg-biosplusefi --ondisk sda --sourceparams="loader=grub-efi" --align 1024
-part / --source rootfs --ondisk sda --fstype=ext4 --use-uuid --align 1024
+part / --source rootfs --ondisk sda --fstype=${OVERLAYFS_ROOTFS_TYPE} --use-uuid --align 1024
  part --ondisk sda --fstype=ext4 --size=5 --align 1024
-bootloader --ptable gpt --timeout=1 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0 ${OVERLAYFS_INIT_OPTION}"
+bootloader --ptable gpt --timeout=1 --append="rootfstype=${OVERLAYFS_ROOTFS_TYPE} console=ttyS0,115200 console=tty0 ${OVERLAYFS_INIT_OPTION}"
meta/lib/oeqa/selftest/cases/overlayfs.py +19 -6
index cd0dc60c64..e31063567b 100644
@@ -353,6 +353,7 @@ EXTRA_IMAGE_FEATURES += "read-only-rootfs"
  # Image configuration for overlayfs-etc
  OVERLAYFS_ETC_MOUNT_POINT = "/data"
  OVERLAYFS_ETC_DEVICE = "/dev/sda3"
+OVERLAYFS_ROOTFS_TYPE = "ext4"
  """
 
          self.write_config(config)
@@ -367,13 +368,17 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3"
 
      @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
      def test_sbin_init_preinit(self):
-        self.run_sbin_init(False)
+        self.run_sbin_init(False, "ext4")
 
      @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
      def test_sbin_init_original(self):
-        self.run_sbin_init(True)
+        self.run_sbin_init(True, "ext4")
 
-    def run_sbin_init(self, origInit):
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
+    def test_sbin_init_read_only(self):
+        self.run_sbin_init(True, "squashfs")
+
+    def run_sbin_init(self, origInit, rootfsType):
          """
          Summary:   Confirm we can replace original init and mount overlay on top of /etc
          Expected:  Image is created successfully and /etc is mounted as an overlay
@@ -384,7 +389,9 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3"
 
          args = {
              'OVERLAYFS_INIT_OPTION': "" if origInit else "init=/sbin/preinit",
-            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True)
+            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True),
+            'OVERLAYFS_ROOTFS_TYPE': rootfsType,
+            'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': int(rootfsType == "ext4")
          }
 
          self.write_config(config.format(**args))
@@ -437,7 +444,9 @@ IMAGE_INSTALL:append = " overlayfs-user"
 
          args = {
              'OVERLAYFS_INIT_OPTION': "",
-            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1
+            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1,
+            'OVERLAYFS_ROOTFS_TYPE': "ext4",
+            'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1
          }
 
          self.write_config(config.format(**args))
@@ -463,10 +472,14 @@ IMAGE_INSTALL:append = " overlayfs-user"
  INIT_MANAGER = "systemd"
 
  # enable overlayfs in the kernel
-KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc"
+KERNEL_EXTRA_FEATURES:append = " \
+    features/overlayfs/overlayfs.scc \
+    cfg/fs/squashfs.scc"
 
  IMAGE_FSTYPES += "wic"
  OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}"
+OVERLAYFS_ROOTFS_TYPE = "{OVERLAYFS_ROOTFS_TYPE}"
+OVERLAYFS_ETC_CREATE_MOUNT_DIRS = "{OVERLAYFS_ETC_CREATE_MOUNT_DIRS}"
  WKS_FILE = "overlayfs_etc.wks.in"
 
  EXTRA_IMAGE_FEATURES += "read-only-rootfs"
@@ -477,4 +490,13 @@ OVERLAYFS_ETC_MOUNT_POINT = "/data"
  OVERLAYFS_ETC_FSTYPE = "ext4"
  OVERLAYFS_ETC_DEVICE = "/dev/sda3"
  OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}"

meta/lib/oeqa/selftest/cases/overlayfs.py OVERLAYFS_ETC_MOUNT_POINT = "/data" · line 502

Quoted 10 lines
meta/lib/oeqa/selftest/cases/overlayfs.py +9 -0
+
+ROOTFS_POSTPROCESS_COMMAND += "{OVERLAYFS_ROOTFS_TYPE}_rootfs"
+
+ext4_rootfs() {{
+}}
+
+squashfs_rootfs() {{
+    mkdir -p ${{IMAGE_ROOTFS}}/data
+}}
  """

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#197527): https://lists.openembedded.org/g/openembedded-core/message/197527
Mute This Topic: https://lists.openembedded.org/mt/104989652/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-