Skip to content

Commit

Permalink
tests/psoc6/flash: Added long string test.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
  • Loading branch information
jaenrig-ifx authored and actions-user committed Sep 15, 2023
1 parent ac48ec7 commit 04da169
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/psoc6/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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()
1 change: 1 addition & 0 deletions tests/psoc6/flash.py.exp
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
This is a test string.
Test successful
Test successful

0 comments on commit 04da169

Please sign in to comment.