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

Heinrich Schuchardt
2022-07-31T11:59:47Z

Add a unit test checking that a full FAT16 directory leads to an error
when trying to add an additional entry.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@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
+ 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}')
+ 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