diff options
author | Damien George <damien.p.george@gmail.com> | 2017-05-09 15:50:40 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-05-09 15:50:40 +1000 |
commit | 9bd67d9fbc09823e33642e7ec709afbf88d11d0a (patch) | |
tree | 40017fcdf9ef888294742fe4e4e9412c5b061c98 | |
parent | d00d062af2743832c22e3fdff7c88db894cf59d8 (diff) |
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.
-rw-r--r-- | tests/extmod/vfs_basic.py | 4 | ||||
-rw-r--r-- | tests/extmod/vfs_fat_more.py | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index 1821a277d..32bfe8ab4 100644 --- a/tests/extmod/vfs_basic.py +++ b/tests/extmod/vfs_basic.py @@ -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) diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 217d63995..6c2df528f 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -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, '/') |