summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extmod/vfs_lfsx.c2
-rw-r--r--tests/extmod/vfs_lfs.py8
-rw-r--r--tests/extmod/vfs_lfs.py.exp4
3 files changed, 13 insertions, 1 deletions
diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c
index b381056b8..9474e960f 100644
--- a/extmod/vfs_lfsx.c
+++ b/extmod/vfs_lfsx.c
@@ -304,7 +304,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(MP_VFS_LFSx(getcwd_obj), MP_VFS_LFSx(getcwd));
STATIC mp_obj_t MP_VFS_LFSx(stat)(mp_obj_t self_in, mp_obj_t path_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
- const char *path = mp_obj_str_get_str(path_in);
+ const char *path = MP_VFS_LFSx(make_path)(self, path_in);
struct LFSx_API (info) info;
int ret = LFSx_API(stat)(&self->lfs, path, &info);
if (ret < 0) {
diff --git a/tests/extmod/vfs_lfs.py b/tests/extmod/vfs_lfs.py
index c3656fe68..1d47605c5 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")
diff --git a/tests/extmod/vfs_lfs.py.exp b/tests/extmod/vfs_lfs.py.exp
index 7d4aed041..de739e733 100644
--- a/tests/extmod/vfs_lfs.py.exp
+++ b/tests/extmod/vfs_lfs.py.exp
@@ -20,6 +20,8 @@ write 3
[('test', 32768, 0, 8), ('testdir', 16384, 0, 0)]
/
/testdir
+(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
/
test <class 'VfsLfs2'>
(1024, 1024, 30, 28, 28, 0, 0, 0, 0, 255)
@@ -43,4 +45,6 @@ write 3
[('testdir', 16384, 0, 0), ('test', 32768, 0, 8)]
/
/testdir
+(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
/