[PATCH v2 5/5] test: add test for full FAT16 directory

AKASHI Takahiro takahiro.akashi at linaro.org
Mon Aug 1 03:50:57 CEST 2022


On Sun, Jul 31, 2022 at 01:58:37PM +0200, Heinrich Schuchardt wrote:
> Add a unit test checking that a full FAT16 directory leads to an error
> when trying to add an additional entry.

Thank you for adding this test case, but
why do you restrict this test to fat16 and the root directory?
The root directory on fat16 is a very much special case and differently
implemented from others. So the test scenario doesn't do what we expect
for fulfilling the whole disk.

I think we should use other sub directories (and other file systems as well).

> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> v2:
> 	new patch
> ---
>  test/py/tests/test_fs/test_mkdir.py | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/test/py/tests/test_fs/test_mkdir.py b/test/py/tests/test_fs/test_mkdir.py
> index f5cc308362..e3a9e3ed27 100644
> --- a/test/py/tests/test_fs/test_mkdir.py
> +++ b/test/py/tests/test_fs/test_mkdir.py
> @@ -119,3 +119,20 @@ class TestMkdir(object):
>              assert('0123456789abcdef00/'  in output)
>              assert('0123456789abcdef13/'  in output)
>              assert_fs_integrity(fs_ubtype, fs_img)
> +
> +    def test_mkdir7(self, u_boot_console, fs_obj_mkdir):
> +        """ Test Case 7 - max out number of root directory entries
> +        """
> +        _, _, fs_type = fs_obj_mkdir

Why not use fs_ubtype, _, fs_type = ..., then

> +        if fs_type != 'fat16':
> +            return
> +        with u_boot_console.log.section('Test Case 7 - mkdir (max out)'):
> +            for i in range(0, 512):
> +                output = u_boot_console.run_command(
> +                    f'fatmkdir host 0:0 /U-Boot-mkdir-max-out-test-directory-{i:05d}')

'%smkdir ...'.format(fs_ubtype, i)

-Takahiro Akashi

> +                if 'Can\'t create directory entry' in output:
> +                    break
> +            # A directory was created
> +            assert i > 0
> +            # The FAT16 root directory has only 512 directory entries
> +            assert i <= 512 / 5
> -- 
> 2.36.1
> 


More information about the U-Boot mailing list