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.
This commit is contained in:
Damien George 2017-05-09 15:50:40 +10:00
parent d00d062af2
commit 9bd67d9fbc
2 changed files with 12 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class Filesystem:
# first we umount any existing mount points the target may have
try:
uos.umount('/')
except OSError:
pass
for path in uos.listdir('/'):
uos.umount('/' + path)

View File

@ -44,6 +44,14 @@ except MemoryError:
print("SKIP")
sys.exit()
# first we umount any existing mount points the target may have
try:
uos.umount('/')
except OSError:
pass
for path in uos.listdir('/'):
uos.umount('/' + path)
uos.VfsFat.mkfs(bdev)
uos.mount(bdev, '/')