All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: fs: Check fat short file name
@ 2023-03-22  8:46 Stefan Herbrechtsmeier
  2023-03-31 14:15 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Herbrechtsmeier @ 2023-03-22  8:46 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Herbrechtsmeier

From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Ensure that a freshly written fat file with a lower case filename which
fits into the upper case 8.3 short filename is not mangeled with a tilde
and number.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 test/py/tests/test_fs/test_ext.py | 36 +++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/test/py/tests/test_fs/test_ext.py b/test/py/tests/test_fs/test_ext.py
index dba874fc59..05fefa53a0 100644
--- a/test/py/tests/test_fs/test_ext.py
+++ b/test/py/tests/test_fs/test_ext.py
@@ -8,11 +8,24 @@
 This test verifies extended write operation on file system.
 """
 
+import os.path
 import pytest
 import re
+from subprocess import check_output
 from fstest_defs import *
 from fstest_helpers import assert_fs_integrity
 
+PLAIN_FILE='abcdefgh.txt'
+MANGLE_FILE='abcdefghi.txt'
+
+def str2fat(long_filename):
+    splitext = os.path.splitext(long_filename.upper())
+    name = splitext[0]
+    ext = splitext[1][1:]
+    if len(name) > 8:
+        name = '%s~1' % name[:6]
+    return '%-8s %s' % (name, ext)
+
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.slow
 class TestFsExt(object):
@@ -317,3 +330,26 @@ class TestFsExt(object):
             assert('FILE0123456789_79' in output)
 
             assert_fs_integrity(fs_type, fs_img)
+
+    def test_fs_ext12(self, u_boot_console, fs_obj_ext):
+        """
+        Test Case 12 - write plain and mangle file
+        """
+        fs_type,fs_img,md5val = fs_obj_ext
+        with u_boot_console.log.section('Test Case 12 - write plain and mangle file'):
+            # Test Case 12a - Check if command successfully returned
+            output = u_boot_console.run_command_list([
+                'host bind 0 %s' % fs_img,
+                '%swrite host 0:0 %x /%s 0'
+                    % (fs_type, ADDR, PLAIN_FILE),
+                '%swrite host 0:0 %x /%s 0'
+                    % (fs_type, ADDR, MANGLE_FILE)])
+            assert('0 bytes written' in ''.join(output))
+            # Test Case 12b - Read file system content
+            output = check_output('mdir -i %s' % fs_img, shell=True).decode()
+            # Test Case 12c - Check if short filename is not mangled
+            assert(str2fat(PLAIN_FILE) in ''.join(output))
+            # Test Case 12d - Check if long filename is mangled
+            assert(str2fat(MANGLE_FILE) in ''.join(output))
+
+            assert_fs_integrity(fs_type, fs_img)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test: fs: Check fat short file name
  2023-03-22  8:46 [PATCH] test: fs: Check fat short file name Stefan Herbrechtsmeier
@ 2023-03-31 14:15 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2023-03-31 14:15 UTC (permalink / raw)
  To: Stefan Herbrechtsmeier; +Cc: u-boot, Stefan Herbrechtsmeier

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

On Wed, Mar 22, 2023 at 09:46:02AM +0100, Stefan Herbrechtsmeier wrote:

> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Ensure that a freshly written fat file with a lower case filename which
> fits into the upper case 8.3 short filename is not mangeled with a tilde
> and number.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-31 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  8:46 [PATCH] test: fs: Check fat short file name Stefan Herbrechtsmeier
2023-03-31 14:15 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.