From 086cb2ae7333a936fd036eb967683c07961af25a Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Mon, 7 Aug 2023 13:28:59 +0200 Subject: [PATCH] tests/psoc6/flash: Added long string test. Signed-off-by: enriquezgarc --- tests/psoc6/flash.py | 23 +++++++++++++++++++++++ tests/psoc6/flash.py.exp | 1 + 2 files changed, 24 insertions(+) diff --git a/tests/psoc6/flash.py b/tests/psoc6/flash.py index fdac69bb855bd..b75771af4e67f 100644 --- a/tests/psoc6/flash.py +++ b/tests/psoc6/flash.py @@ -7,6 +7,7 @@ os.umount("/") test_string = "This is a test string." +long_test_string = "This is a very long string. And as a long string that it is, it is only getting longer and longer and the string goes. How long shall it be? Well, not really sure, but let´s try it like this." print(test_string) # first priority is always LFS2 filesystem as it is the default @@ -37,6 +38,17 @@ print("Test successful") f.close() + # open a file and do some operation + f = open("/flash/test_lfs2_2.txt", "w") + f.write(long_test_string) + f.close() + + # read back the contents + f = open("/flash/test_lfs2_2.txt", "r") + if f.read() == long_test_string: + print("Test successful") + f.close() + if "VfsFat" in dir(os): # create a FAT fs and mount it, else format and mount it try: @@ -57,3 +69,14 @@ if f.read() == test_string: print("Test successful") f.close() + + # open a file and do some operation + f = open("/flash/test_fat_2.txt", "w") + f.write(long_test_string) + f.close() + + # read back the contents + f = open("/flash/test_fat_2.txt", "r") + if f.read() == long_test_string: + print("Test successful") + f.close() diff --git a/tests/psoc6/flash.py.exp b/tests/psoc6/flash.py.exp index ebf73f8bf0104..fe356ae4991d4 100644 --- a/tests/psoc6/flash.py.exp +++ b/tests/psoc6/flash.py.exp @@ -1,2 +1,3 @@ This is a test string. Test successful +Test successful