[Buildroot] [git commit] support/testing: add fs tests
Romain Naour
romain.naour at gmail.com
Thu Sep 2 21:46:56 UTC 2021
Hello Thomas, All,
Le 07/05/2017 à 22:04, Thomas Petazzoni a écrit :
> commit: https://git.buildroot.net/buildroot/commit/?id=bf4a6490e4ee70f0a46e588602995ba34e6c872a
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
>
> This commit adds a number of test cases for various filesystem formats:
> ext2/3/4, iso9660, jffs2, squashfs, ubi/ubifs and yaffs2. All of them
> except yaffs2 are runtime tested. The iso9660 set of test cases is
> particularly rich, testing the proper operation of the iso9660 support
> with all of grub, grub2 and isolinux.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> ---
> support/testing/conf/grub-menu.lst | 20 +++
> support/testing/conf/grub2.cfg | 7 +
> support/testing/conf/isolinux.cfg | 5 +
> .../testing/conf/minimal-x86-qemu-kernel.config | 23 +++
> support/testing/tests/fs/__init__.py | 0
> support/testing/tests/fs/test_ext.py | 119 +++++++++++++++
> support/testing/tests/fs/test_iso9660.py | 162 +++++++++++++++++++++
> support/testing/tests/fs/test_jffs2.py | 45 ++++++
> support/testing/tests/fs/test_squashfs.py | 37 +++++
> support/testing/tests/fs/test_ubi.py | 39 +++++
> support/testing/tests/fs/test_yaffs2.py | 12 ++
> 11 files changed, 469 insertions(+)
>
[...]
> diff --git a/support/testing/tests/fs/test_ubi.py b/support/testing/tests/fs/test_ubi.py
> new file mode 100644
> index 0000000..ede4999
> --- /dev/null
> +++ b/support/testing/tests/fs/test_ubi.py
> @@ -0,0 +1,39 @@
> +import subprocess
> +import os
> +
> +import infra.basetest
> +
> +class TestUbi(infra.basetest.BRTest):
> + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
> +"""
> +BR2_TARGET_ROOTFS_UBIFS=y
> +BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
> +BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
> +BR2_TARGET_ROOTFS_UBI=y
> +BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
> +BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
Why the default value provided by Buildroot (Kconfig) are not used here ?
> +"""
> +
> + # TODO: if you boot Qemu twice on the same UBI image, it fails to
> + # attach the image the second time, with "ubi0 error:
> + # ubi_read_volume_table: the layout volume was not found".
> + # To be investigated.
> + def test_run(self):
> + img = os.path.join(self.builddir, "images", "rootfs.ubi")
> + out = subprocess.check_output(["file", img],
> + cwd=self.builddir,
> + env={"LANG": "C"})
> + out = out.splitlines()
> +
> + subprocess.call(["truncate", "-s 128M", img])
Since Qemu 4.0, this test doesn't work anymore due to a new check between the
backend and device size:
https://git.qemu.org/?p=qemu.git;a=commit;h=06f1521795207359a395996c253c306f4ab7586e
See: https://gitlab.com/kubu93/buildroot/-/jobs/1543100932
The pflash device provided by Qemu for ARM vexpress-a9 target is 64M [1] but the
ARM vexpress devicetree describe a 128M flash device [2]
The size of rootfs.ubi image is reduced to 64M to allow booting Qemu.
dmesg:
physmap-flash 40000000.flash: physmap platform flash device: [mem
0x40000000-0x43ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID
0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
physmap-flash 40000000.flash: physmap platform flash device: [mem
0x44000000-0x47ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID
0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
Concatenating MTD devices:
(0): "40000000.flash"
(1): "40000000.flash"
into device "40000000.flash"
physmap-flash 48000000.psram: physmap platform flash device: [mem
0x48000000-0x49ffffff]
[...]
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: attached mtd0 (name "40000000.flash", size 128 MiB)
ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
ubi0: min./max. I/O unit sizes: 1/4096, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 512, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number:
251135262
ubi0: available PEBs: 492, total reserved PEBs: 20, PEBs reserved for bad PEB
handling: 0
[...]
But for some reason, the filesystem can't be mounted...
List of all partitions:
1f00 131072 mtdblock0
(driver?)
1f01 32768 mtdblock1
(driver?)
No filesystem could mount root, tried:
ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[1]
https://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm/vexpress.c;h=58481c07629aedb09864dcc72757ff7947e733bb;hb=HEAD#l50
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/boot/dts/vexpress-v2m.dtsi?h=v5.14#n33
The issue was not detected until now since we are sill using an old qemu (2.8)
for testing in gitlab (using the Buildroot Docker image used by gitlab-ci.yml).
Any idea ?
Best regards,
Romain
> +
> + self.emulator.boot(arch="armv7",
> + kernel="builtin",
> + kernel_cmdline=["root=ubi0:rootfs",
> + "ubi.mtd=0",
> + "rootfstype=ubifs"],
> + options=["-drive", "file={},if=pflash".format(img)])
> + self.emulator.login()
> + cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
> + _, exit_code = self.emulator.run(cmd)
> + self.assertEqual(exit_code, 0)
More information about the buildroot
mailing list