Message ID | 20240818112652.1232927-1-ju.o@free.fr |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] support/testing: fs: new erofs runtime test | expand |
On 18/08/2024 13:26, Julien Olivain wrote: > Signed-off-by: Julien Olivain <ju.o@free.fr> Applied to master, thanks. Regards, Arnout > --- > Patch tested in: > https://gitlab.com/jolivain/buildroot/-/jobs/7606961571 > --- > DEVELOPERS | 2 + > support/testing/tests/fs/test_erofs.py | 51 +++++++++++++++++++ > .../tests/fs/test_erofs/linux-erofs.fragment | 1 + > 3 files changed, 54 insertions(+) > create mode 100644 support/testing/tests/fs/test_erofs.py > create mode 100644 support/testing/tests/fs/test_erofs/linux-erofs.fragment > > diff --git a/DEVELOPERS b/DEVELOPERS > index d7d0af3543..5113b5e60d 100644 > --- a/DEVELOPERS > +++ b/DEVELOPERS > @@ -1820,6 +1820,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_erofs.py > +F: support/testing/tests/fs/test_erofs/ > F: support/testing/tests/package/sample_python_distro.py > F: support/testing/tests/package/sample_python_gnupg.py > F: support/testing/tests/package/sample_python_hwdata.py > diff --git a/support/testing/tests/fs/test_erofs.py b/support/testing/tests/fs/test_erofs.py > new file mode 100644 > index 0000000000..47c75262e0 > --- /dev/null > +++ b/support/testing/tests/fs/test_erofs.py > @@ -0,0 +1,51 @@ > +import os > + > +import infra.basetest > + > + > +class TestErofs(infra.basetest.BRTest): > + kern_frag = \ > + infra.filepath("tests/fs/test_erofs/linux-erofs.fragment") > + config = \ > + f""" > + BR2_aarch64=y > + BR2_TOOLCHAIN_EXTERNAL=y > + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" > + BR2_LINUX_KERNEL=y > + BR2_LINUX_KERNEL_CUSTOM_VERSION=y > + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.46" > + 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_EROFS_UTILS=y > + BR2_TARGET_ROOTFS_EROFS=y > + # BR2_TARGET_ROOTFS_TAR is not set > + """ > + > + def test_run(self): > + root_dev = "/dev/vda" > + disk = os.path.join(self.builddir, "images", "rootfs.erofs") > + kern = os.path.join(self.builddir, "images", "Image") > + bootargs = [f"root={root_dev}", "console=ttyAMA0"] > + qemu_opts = ["-M", "virt", "-cpu", "cortex-a57", "-m", "256M", > + "-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 erofs format. > + cmd = "mount | grep '/dev/root on / type erofs'" > + self.assertRunOk(cmd) > + > + # Since we are on a read-only mounted filesystem, we can run a > + # check... > + self.assertRunOk(f"fsck.erofs {root_dev}") > + > + # We check we can dump the superblock. > + self.assertRunOk(f"dump.erofs -s {root_dev}") > + > + # We check we can dump statistics on the image. > + self.assertRunOk(f"dump.erofs -S {root_dev}") > diff --git a/support/testing/tests/fs/test_erofs/linux-erofs.fragment b/support/testing/tests/fs/test_erofs/linux-erofs.fragment > new file mode 100644 > index 0000000000..e14017aae4 > --- /dev/null > +++ b/support/testing/tests/fs/test_erofs/linux-erofs.fragment > @@ -0,0 +1 @@ > +CONFIG_EROFS_FS=y
>>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes: > On 18/08/2024 13:26, Julien Olivain wrote: >> Signed-off-by: Julien Olivain <ju.o@free.fr> > Applied to master, thanks. Committed to 2024.02.x and 2024.08.x, thanks.
diff --git a/DEVELOPERS b/DEVELOPERS index d7d0af3543..5113b5e60d 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1820,6 +1820,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_erofs.py +F: support/testing/tests/fs/test_erofs/ F: support/testing/tests/package/sample_python_distro.py F: support/testing/tests/package/sample_python_gnupg.py F: support/testing/tests/package/sample_python_hwdata.py diff --git a/support/testing/tests/fs/test_erofs.py b/support/testing/tests/fs/test_erofs.py new file mode 100644 index 0000000000..47c75262e0 --- /dev/null +++ b/support/testing/tests/fs/test_erofs.py @@ -0,0 +1,51 @@ +import os + +import infra.basetest + + +class TestErofs(infra.basetest.BRTest): + kern_frag = \ + infra.filepath("tests/fs/test_erofs/linux-erofs.fragment") + config = \ + f""" + BR2_aarch64=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.46" + 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_EROFS_UTILS=y + BR2_TARGET_ROOTFS_EROFS=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def test_run(self): + root_dev = "/dev/vda" + disk = os.path.join(self.builddir, "images", "rootfs.erofs") + kern = os.path.join(self.builddir, "images", "Image") + bootargs = [f"root={root_dev}", "console=ttyAMA0"] + qemu_opts = ["-M", "virt", "-cpu", "cortex-a57", "-m", "256M", + "-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 erofs format. + cmd = "mount | grep '/dev/root on / type erofs'" + self.assertRunOk(cmd) + + # Since we are on a read-only mounted filesystem, we can run a + # check... + self.assertRunOk(f"fsck.erofs {root_dev}") + + # We check we can dump the superblock. + self.assertRunOk(f"dump.erofs -s {root_dev}") + + # We check we can dump statistics on the image. + self.assertRunOk(f"dump.erofs -S {root_dev}") diff --git a/support/testing/tests/fs/test_erofs/linux-erofs.fragment b/support/testing/tests/fs/test_erofs/linux-erofs.fragment new file mode 100644 index 0000000000..e14017aae4 --- /dev/null +++ b/support/testing/tests/fs/test_erofs/linux-erofs.fragment @@ -0,0 +1 @@ +CONFIG_EROFS_FS=y
Signed-off-by: Julien Olivain <ju.o@free.fr> --- Patch tested in: https://gitlab.com/jolivain/buildroot/-/jobs/7606961571 --- DEVELOPERS | 2 + support/testing/tests/fs/test_erofs.py | 51 +++++++++++++++++++ .../tests/fs/test_erofs/linux-erofs.fragment | 1 + 3 files changed, 54 insertions(+) create mode 100644 support/testing/tests/fs/test_erofs.py create mode 100644 support/testing/tests/fs/test_erofs/linux-erofs.fragment