summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/vfs_lfs_mount.py17
-rw-r--r--tests/extmod/vfs_lfs_mount.py.exp6
2 files changed, 23 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()
diff --git a/tests/extmod/vfs_lfs_mount.py.exp b/tests/extmod/vfs_lfs_mount.py.exp
index b5c521531..aa654ebe0 100644
--- a/tests/extmod/vfs_lfs_mount.py.exp
+++ b/tests/extmod/vfs_lfs_mount.py.exp
@@ -2,7 +2,13 @@ test <class 'VfsLfs1'>
hello from lfs
package
hello from lfs
+lfsmod2.py: print("hello from lfs")
+
+OSError(30,)
test <class 'VfsLfs2'>
hello from lfs
package
hello from lfs
+lfsmod2.py: print("hello from lfs")
+
+OSError(36,)