summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/vfs_lfs.py
diff options
context:
space:
mode:
authorrobert <robert@hammelrath.com>2020-04-29 18:13:22 +0200
committerDamien George <damien.p.george@gmail.com>2020-05-08 21:37:51 +1000
commita5ea4b9f3f3fd394afdf65223b5e55c8d9fccc53 (patch)
treeb5bf89a068d617cbd5785e2b54f4a6d4c2f0dbfa /tests/extmod/vfs_lfs.py
parent037c83b0ed47abe68c47c8fa617fdc0041b699f0 (diff)
downloadmicropython-a5ea4b9f3f3fd394afdf65223b5e55c8d9fccc53.tar.gz
micropython-a5ea4b9f3f3fd394afdf65223b5e55c8d9fccc53.zip
extmod/vfs_lfsx: Fix path handling in uos.stat() to consider cur dir.
This fixes the bug, that stat(filename) would not consider the current working directory. So if e.g. the cwd is "lib", then stat("main.py") would return the info for "/main.py" instead of "/lib/main.py".
Diffstat (limited to 'tests/extmod/vfs_lfs.py')
-rw-r--r--tests/extmod/vfs_lfs.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/extmod/vfs_lfs.py b/tests/extmod/vfs_lfs.py
index c3656fe687..1d47605c55 100644
--- a/tests/extmod/vfs_lfs.py
+++ b/tests/extmod/vfs_lfs.py
@@ -101,6 +101,14 @@ def test(bdev, vfs_class):
print(vfs.getcwd())
vfs.chdir("/testdir")
print(vfs.getcwd())
+
+ # create file in directory to make sure paths are relative
+ vfs.open("test2", "w").close()
+ print(vfs.stat("test2"))
+ print(vfs.stat("/testdir/test2"))
+ vfs.remove("test2")
+
+ # chdir back to root and remove testdir
vfs.chdir("/")
print(vfs.getcwd())
vfs.rmdir("testdir")