diff options
author | robert <robert@hammelrath.com> | 2020-05-03 21:05:08 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-05-08 21:52:15 +1000 |
commit | d3ea28d04a7df9ca536a9002c8fda2f6e3a88f09 (patch) | |
tree | 130170efeea1cb3f89fa2f6c0faf7ef394b6f259 /tests/extmod/vfs_lfs.py | |
parent | a5ea4b9f3f3fd394afdf65223b5e55c8d9fccc53 (diff) | |
download | micropython-d3ea28d04a7df9ca536a9002c8fda2f6e3a88f09.tar.gz micropython-d3ea28d04a7df9ca536a9002c8fda2f6e3a88f09.zip |
extmod/vfs_lfsx: Normalize path name in chdir.
This change scans for '.', '..' and multiple '/' and normalizes the new
path name. If the resulting path does not exist, an error is raised.
Non-existing interim path elements are ignored if they are removed during
normalization.
Diffstat (limited to 'tests/extmod/vfs_lfs.py')
-rw-r--r-- | tests/extmod/vfs_lfs.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/extmod/vfs_lfs.py b/tests/extmod/vfs_lfs.py index 1d47605c55..82c8fead5a 100644 --- a/tests/extmod/vfs_lfs.py +++ b/tests/extmod/vfs_lfs.py @@ -98,6 +98,8 @@ def test(bdev, vfs_class): print(list(vfs.ilistdir())) # getcwd, chdir + vfs.mkdir("/testdir2") + vfs.mkdir("/testdir/subdir") print(vfs.getcwd()) vfs.chdir("/testdir") print(vfs.getcwd()) @@ -111,7 +113,29 @@ def test(bdev, vfs_class): # chdir back to root and remove testdir vfs.chdir("/") print(vfs.getcwd()) + vfs.chdir("testdir") + print(vfs.getcwd()) + vfs.chdir("..") + print(vfs.getcwd()) + vfs.chdir("testdir/subdir") + print(vfs.getcwd()) + vfs.chdir("../..") + print(vfs.getcwd()) + vfs.chdir("/./testdir2") + print(vfs.getcwd()) + vfs.chdir("../testdir") + print(vfs.getcwd()) + vfs.chdir("../..") + print(vfs.getcwd()) + vfs.chdir(".//testdir") + print(vfs.getcwd()) + vfs.chdir("subdir/./") + print(vfs.getcwd()) + vfs.chdir("/") + print(vfs.getcwd()) + vfs.rmdir("testdir/subdir") vfs.rmdir("testdir") + vfs.rmdir("testdir2") bdev = RAMBlockDevice(30) |