From 9bd67d9fbc09823e33642e7ec709afbf88d11d0a Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 9 May 2017 15:50:40 +1000 Subject: [PATCH] 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. --- tests/extmod/vfs_basic.py | 4 ++++ tests/extmod/vfs_fat_more.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index 1821a277dc..32bfe8ab4d 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 217d639956..6c2df528fb 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, '/')