diff options
| author | Damien George <damien@micropython.org> | 2020-10-29 11:31:53 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2020-10-29 11:43:52 +1100 |
| commit | 03a1f94ea16a532bd4219092edb06e251d9a0ca5 (patch) | |
| tree | 85b12095c9e2a9dbddac8794cc0bddce9ea53ffa /tests/extmod/vfs_lfs_mount.py | |
| parent | 0118c07916c24a6ccb6dbd0ea904312f01798b40 (diff) | |
extmod/vfs_lfs: Support mounting LFS filesystems in read-only mode.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/vfs_lfs_mount.py')
| -rw-r--r-- | tests/extmod/vfs_lfs_mount.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/extmod/vfs_lfs_mount.py b/tests/extmod/vfs_lfs_mount.py index 2c40b2989..3d8cec607 100644 --- a/tests/extmod/vfs_lfs_mount.py +++ b/tests/extmod/vfs_lfs_mount.py @@ -67,6 +67,23 @@ def test(bdev, vfs_class): # umount uos.umount("/lfs") + # mount read-only + vfs = vfs_class(bdev) + uos.mount(vfs, "/lfs", readonly=True) + + # test reading works + with open("/lfs/subdir/lfsmod2.py") as f: + print("lfsmod2.py:", f.read()) + + # test writing fails + try: + open("/lfs/test_write", "w") + except OSError as er: + print(repr(er)) + + # umount + uos.umount("/lfs") + # clear imported modules usys.modules.clear() |
