summaryrefslogtreecommitdiff
path: root/test/py/tests/test_fs/conftest.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-04-02 20:01:14 -0600
committerTom Rini <trini@konsulko.com>2025-04-02 20:01:14 -0600
commit0a174922c6b292237846a75bbbfd3e97b29cb497 (patch)
tree9bbb8c0fb164568424c938404ca411879397bd73 /test/py/tests/test_fs/conftest.py
parent177d73dd17705e77b1830a7354425636f617666d (diff)
parent8d0cc62a60b5b92a010f75fd61d9eb9cb8299567 (diff)
Merge patch series "fs: exfat: Add exfat port based on exfat-fuse"
Marek Vasut <marex@denx.de> says: Import exfat-fuse libexfat, add U-Boot filesystem layer porting glue code and wire exfat support into generic filesystem support code. This adds exfat support to U-Boot. Fill in generic filesystem interface for mkdir and rm commands. Make filesystem tests test the generic interface as well as exfat, to make sure this code does not fall apart. Link: https://github.com/relan/exfat/commits/0b41c6d3560d ("CI: bump FreeBSD to 13.1.") Link: https://lore.kernel.org/r/20250317031418.223019-1-marex@denx.de
Diffstat (limited to 'test/py/tests/test_fs/conftest.py')
-rw-r--r--test/py/tests/test_fs/conftest.py44
1 files changed, 35 insertions, 9 deletions
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 47a584ffe7c..c73fb4abbcb 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -11,11 +11,11 @@ from fstest_defs import *
# pylint: disable=E0611
from tests import fs_helper
-supported_fs_basic = ['fat16', 'fat32', 'ext4']
-supported_fs_ext = ['fat12', 'fat16', 'fat32']
+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']
-supported_fs_unlink = ['fat12', 'fat16', 'fat32']
+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']
@@ -108,6 +108,22 @@ def pytest_generate_tests(metafunc):
#
# Helper functions
#
+def fstype_to_prefix(fs_type):
+ """Convert a file system type to an U-Boot command prefix
+
+ Args:
+ fs_type: File system type.
+
+ Return:
+ A corresponding command prefix for file system type.
+ """
+ if fs_type == 'fs_generic' or fs_type == 'exfat':
+ return ''
+ elif re.match('fat', fs_type):
+ return 'fat'
+ else:
+ return fs_type
+
def fstype_to_ubname(fs_type):
"""Convert a file system type to an U-Boot specific string
@@ -139,8 +155,12 @@ 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' or fs_type == 'exfat':
+ return
if not config.buildconfig.get('config_%s_write' % fs_type, None):
pytest.skip('.config feature "%s_WRITE" not enabled'
% fs_type.upper())
@@ -178,6 +198,8 @@ def fs_obj_basic(request, u_boot_config):
volume file name and a list of MD5 hashes.
"""
fs_type = request.param
+ fs_cmd_prefix = fstype_to_prefix(fs_type)
+ fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)
@@ -267,7 +289,7 @@ def fs_obj_basic(request, u_boot_config):
pytest.skip('Setup failed for filesystem: ' + fs_type + '. {}'.format(err))
return
else:
- yield [fs_ubtype, fs_img, md5val]
+ yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fs_img, md5val]
finally:
call('rm -rf %s' % scratch_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)
@@ -288,6 +310,8 @@ def fs_obj_ext(request, u_boot_config):
volume file name and a list of MD5 hashes.
"""
fs_type = request.param
+ fs_cmd_prefix = fstype_to_prefix(fs_type)
+ fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)
@@ -357,7 +381,7 @@ def fs_obj_ext(request, u_boot_config):
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
- yield [fs_ubtype, fs_img, md5val]
+ yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fs_img, md5val]
finally:
call('rm -rf %s' % scratch_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)
@@ -378,6 +402,7 @@ def fs_obj_mkdir(request, u_boot_config):
volume file name.
"""
fs_type = request.param
+ fs_cmd_prefix = fstype_to_prefix(fs_type)
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)
@@ -390,7 +415,7 @@ def fs_obj_mkdir(request, u_boot_config):
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
- yield [fs_ubtype, fs_img]
+ yield [fs_ubtype, fs_cmd_prefix, fs_img]
call('rm -f %s' % fs_img, shell=True)
#
@@ -409,6 +434,7 @@ def fs_obj_unlink(request, u_boot_config):
volume file name.
"""
fs_type = request.param
+ fs_cmd_prefix = fstype_to_prefix(fs_type)
fs_img = ''
fs_ubtype = fstype_to_ubname(fs_type)
@@ -456,7 +482,7 @@ def fs_obj_unlink(request, u_boot_config):
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
- yield [fs_ubtype, fs_img]
+ yield [fs_ubtype, fs_cmd_prefix, fs_img]
finally:
call('rm -rf %s' % scratch_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)