[Buildroot] [PATCH 1/1] support/testing: fs: new cramfs runtime test

Julien Olivain via buildroot <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
Signed-off-by: Julien Olivain <[email protected]>
---
Patch tested in:
https://gitlab.com/jolivain/buildroot/-/jobs/15915576004
---
 DEVELOPERS                                    |  2 +
 support/testing/tests/fs/test_cramfs.py       | 42 +++++++++++++++++++
 .../fs/test_cramfs/linux-cramfs.fragment      |  1 +
 3 files changed, 45 insertions(+)
 create mode 100644 support/testing/tests/fs/test_cramfs.py
 create mode 100644 support/testing/tests/fs/test_cramfs/linux-cramfs.fragment

diff --git a/DEVELOPERS b/DEVELOPERS
index 4460523447..586407a200 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1856,6 +1856,8 @@ F:	support/testing/tests/boot/test_optee_os.py
 F:	support/testing/tests/boot/test_optee_os/
 F:	support/testing/tests/fs/test_btrfs.py
 F:	support/testing/tests/fs/test_btrfs/
+F:	support/testing/tests/fs/test_cramfs.py
+F:	support/testing/tests/fs/test_cramfs/
 F:	support/testing/tests/fs/test_erofs.py
 F:	support/testing/tests/fs/test_erofs/
 F:	support/testing/tests/fs/test_xfs.py
diff --git a/support/testing/tests/fs/test_cramfs.py b/support/testing/tests/fs/test_cramfs.py
new file mode 100644
index 0000000000..8beb27f4ab
--- /dev/null
+++ b/support/testing/tests/fs/test_cramfs.py
@@ -0,0 +1,42 @@
+import os
+
+import infra.basetest
+
+
+class TestCramfs(infra.basetest.BRTest):
+    kern_frag = \
+        infra.filepath("tests/fs/test_cramfs/linux-cramfs.fragment")
+    config = \
+        f"""
+        BR2_aarch64=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.44"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kern_frag}"
+        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+        BR2_PACKAGE_CRAMFS=y
+        BR2_TARGET_ROOTFS_CRAMFS=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        disk = os.path.join(self.builddir, "images", "rootfs.cramfs")
+        kern = os.path.join(self.builddir, "images", "Image")
+        bootargs = ["root=/dev/vda"]
+        qemu_opts = ["-M", "virt", "-cpu", "cortex-a57", "-m", "512M",
+                     "-drive", f"file={disk},if=virtio,format=raw"]
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=bootargs,
+                           options=qemu_opts)
+        self.emulator.login()
+
+        # We check our root filesystem is in cramfs format.
+        cmd = "mount | grep '/dev/root on / type cramfs'"
+        self.assertRunOk(cmd)
+
+        # We run cramfsck on the filesystem.
+        self.assertRunOk("cramfsck -v /dev/vda")
diff --git a/support/testing/tests/fs/test_cramfs/linux-cramfs.fragment b/support/testing/tests/fs/test_cramfs/linux-cramfs.fragment
new file mode 100644
index 0000000000..91bc54bed3
--- /dev/null
+++ b/support/testing/tests/fs/test_cramfs/linux-cramfs.fragment
@@ -0,0 +1 @@
+CONFIG_CRAMFS=y
-- 
2.55.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.