From bd4ac802e406d6544fb0726398f275a4949782c3 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Sat, 15 Aug 2026 15:04:30 +0200 Subject: [PATCH] support/testing: fs: new cramfs runtime test Signed-off-by: Julien Olivain --- 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 5eb438906f..7b0ff1ff86 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