support/testing: fs: new cramfs runtime test

Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit bd4ac802e4)
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
This commit is contained in:
Julien Olivain
2026-08-15 15:04:30 +02:00
committed by Raphaël Mélotte
parent 46744de96b
commit 17a03c09db
3 changed files with 45 additions and 0 deletions

View File

@@ -1786,6 +1786,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/package/sample_python_distro.py

View File

@@ -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")

View File

@@ -0,0 +1 @@
CONFIG_CRAMFS=y