test_fs: Add exfat tests

Add tests for the exfat filesystem. These tests are largely an
extension of the FS_GENERIC tests with the following notable
exceptions.

The filesystem image for exfat tests is generated using combination
of exfatprogs mkfs.exfat and python fattools. The fattols are capable
of generating exfat filesystem images too, but this is not used, the
fattools are only used as a replacement for dosfstools 'mcopy' and
'mdir', which are used to insert files and directories into existing
fatfs images and list existing fatfs images respectively, without the
need for superuser access to mount such images.

The exfat filesystem has no filesystem specific command, there is only
the generic filesystem command interface, therefore check_ubconfig()
has to special case exfat and skip check for CONFIG_CMD_EXFAT and
instead check for CONFIG_FS_EXFAT.

Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marek Vasut
2025-03-17 04:12:50 +01:00
committed by Tom Rini
parent 99b976712b
commit 8d0cc62a60
6 changed files with 35 additions and 17 deletions

View File

@@ -11,11 +11,11 @@ from fstest_defs import *
# pylint: disable=E0611
from tests import fs_helper
supported_fs_basic = ['fat16', 'fat32', 'ext4', 'fs_generic']
supported_fs_ext = ['fat12', 'fat16', 'fat32', 'fs_generic']
supported_fs_basic = ['fat16', 'fat32', 'exfat', 'ext4', 'fs_generic']
supported_fs_ext = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic']
supported_fs_fat = ['fat12', 'fat16']
supported_fs_mkdir = ['fat12', 'fat16', 'fat32', 'fs_generic']
supported_fs_unlink = ['fat12', 'fat16', 'fat32', 'fs_generic']
supported_fs_mkdir = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic']
supported_fs_unlink = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic']
supported_fs_symlink = ['ext4']
supported_fs_rename = ['fat12', 'fat16', 'fat32']
@@ -117,7 +117,7 @@ def fstype_to_prefix(fs_type):
Return:
A corresponding command prefix for file system type.
"""
if fs_type == 'fs_generic':
if fs_type == 'fs_generic' or fs_type == 'exfat':
return ''
elif re.match('fat', fs_type):
return 'fat'
@@ -155,9 +155,11 @@ def check_ubconfig(config, fs_type):
Return:
Nothing.
"""
if not config.buildconfig.get('config_cmd_%s' % fs_type, None):
if fs_type == 'exfat' and not config.buildconfig.get('config_fs_%s' % fs_type, None):
pytest.skip('.config feature "FS_%s" not enabled' % fs_type.upper())
if fs_type != 'exfat' and not config.buildconfig.get('config_cmd_%s' % fs_type, None):
pytest.skip('.config feature "CMD_%s" not enabled' % fs_type.upper())
if fs_type == 'fs_generic':
if fs_type == 'fs_generic' or fs_type == 'exfat':
return
if not config.buildconfig.get('config_%s_write' % fs_type, None):
pytest.skip('.config feature "%s_WRITE" not enabled'
@@ -197,7 +199,7 @@ def fs_obj_basic(request, u_boot_config):
"""
fs_type = request.param
fs_cmd_prefix = fstype_to_prefix(fs_type)
fs_cmd_write = 'save' if fs_type == 'fs_generic' else 'write'
fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)
@@ -309,7 +311,7 @@ def fs_obj_ext(request, u_boot_config):
"""
fs_type = request.param
fs_cmd_prefix = fstype_to_prefix(fs_type)
fs_cmd_write = 'save' if fs_type == 'fs_generic' else 'write'
fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)