Skip to content

Commit 9bd67d9

Browse files
committed
tests/extmod: Make some vfs tests fully unmount FSs before running.
Otherwise the existing FSs can interfere with the tests, and in some cases the tests can write to the real FS on the device.
1 parent d00d062 commit 9bd67d9

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

tests/extmod/vfs_basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def open(self, file, mode):
4747

4848

4949
# first we umount any existing mount points the target may have
50+
try:
51+
uos.umount('/')
52+
except OSError:
53+
pass
5054
for path in uos.listdir('/'):
5155
uos.umount('/' + path)
5256

tests/extmod/vfs_fat_more.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def ioctl(self, op, arg):
4444
print("SKIP")
4545
sys.exit()
4646

47+
# first we umount any existing mount points the target may have
48+
try:
49+
uos.umount('/')
50+
except OSError:
51+
pass
52+
for path in uos.listdir('/'):
53+
uos.umount('/' + path)
54+
4755
uos.VfsFat.mkfs(bdev)
4856
uos.mount(bdev, '/')
4957

0 commit comments

Comments
 (0)