summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-24 20:55:05 +1100
committerDamien George <damien.p.george@gmail.com>2017-01-27 13:19:10 +1100
commit94d87fbb308bf26e35cbb50f294fb06f178df871 (patch)
tree8894925e2f428c7053d39eda4c6189d7c961a7f9
parent5395f5bc714785ce1692881531240c4a14e4cf0c (diff)
downloadmicropython-94d87fbb308bf26e35cbb50f294fb06f178df871.tar.gz
micropython-94d87fbb308bf26e35cbb50f294fb06f178df871.zip
test/extmod: Update vfs_fat tests for new OO FatFs library.
The new version of FatFs requires a minimum of 50 blocks on the device. Also, some tests no longer make sense with an OO vfs.
-rw-r--r--tests/extmod/vfs_fat_fileio.py10
-rw-r--r--tests/extmod/vfs_fat_fsusermount.py5
-rw-r--r--tests/extmod/vfs_fat_fsusermount.py.exp1
-rw-r--r--tests/extmod/vfs_fat_oldproto.py6
-rw-r--r--tests/extmod/vfs_fat_oldproto.py.exp1
-rw-r--r--tests/extmod/vfs_fat_ramdisk.py16
-rw-r--r--tests/extmod/vfs_fat_ramdisk.py.exp5
7 files changed, 11 insertions, 33 deletions
diff --git a/tests/extmod/vfs_fat_fileio.py b/tests/extmod/vfs_fat_fileio.py
index f050d94e27..fd84cdca8f 100644
--- a/tests/extmod/vfs_fat_fileio.py
+++ b/tests/extmod/vfs_fat_fileio.py
@@ -34,7 +34,7 @@ class RAMFS:
try:
- bdev = RAMFS(48)
+ bdev = RAMFS(50)
except MemoryError:
print("SKIP")
sys.exit()
@@ -91,7 +91,7 @@ with vfs.open("foo_file.txt") as f2:
# using constructor of FileIO type to open a file
FileIO = type(f)
-with FileIO("foo_file.txt") as f:
+with FileIO("/ramdisk/foo_file.txt") as f:
print(f.read())
# dirs
@@ -118,9 +118,9 @@ except OSError as e:
print(e.args[0] == uerrno.ENOENT)
try:
- vfs.rename("foo_dir", "/null")
+ vfs.rename("foo_dir", "/null/file")
except OSError as e:
- print(e.args[0] == uerrno.ENODEV)
+ print(e.args[0] == uerrno.ENOENT)
# file in dir
with vfs.open("foo_dir/file-in-dir.txt", "w+t") as f:
@@ -139,7 +139,7 @@ except OSError as e:
print(e.args[0] == uerrno.EACCES)
# trim full path
-vfs.rename("foo_dir/file-in-dir.txt", "/ramdisk/foo_dir/file.txt")
+vfs.rename("foo_dir/file-in-dir.txt", "foo_dir/file.txt")
print(vfs.listdir("foo_dir"))
vfs.rename("foo_dir/file.txt", "moved-to-root.txt")
diff --git a/tests/extmod/vfs_fat_fsusermount.py b/tests/extmod/vfs_fat_fsusermount.py
index 7326172eed..0ab15d827c 100644
--- a/tests/extmod/vfs_fat_fsusermount.py
+++ b/tests/extmod/vfs_fat_fsusermount.py
@@ -34,7 +34,7 @@ class RAMFS:
try:
- bdev = RAMFS(48)
+ bdev = RAMFS(50)
except MemoryError:
print("SKIP")
sys.exit()
@@ -75,6 +75,7 @@ uos.vfs_mount(bdev, "/ramdisk")
uos.vfs_umount("/ramdisk")
# readonly mount
+# note: this test doesn't work correctly with new OO FatFs
uos.vfs_mount(bdev, "/ramdisk", readonly=True)
vfs = uos.VfsFat(bdev, "/ramdisk")
try:
@@ -89,7 +90,7 @@ uos.vfs_mount(None, "/ramdisk")
dev = []
try:
for i in range(0,4):
- dev.append(RAMFS(48))
+ dev.append(RAMFS(50))
uos.vfs_mkfs(dev[i], "/ramdisk" + str(i))
uos.vfs_mount(dev[i], "/ramdisk" + str(i))
except OSError as e:
diff --git a/tests/extmod/vfs_fat_fsusermount.py.exp b/tests/extmod/vfs_fat_fsusermount.py.exp
index 3b30688dd9..3ace58372e 100644
--- a/tests/extmod/vfs_fat_fsusermount.py.exp
+++ b/tests/extmod/vfs_fat_fsusermount.py.exp
@@ -3,5 +3,4 @@ can't mount
True
can't umount
can't umount
-EROFS: True
too many devices mounted
diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py
index 73983567d9..b43fbd286a 100644
--- a/tests/extmod/vfs_fat_oldproto.py
+++ b/tests/extmod/vfs_fat_oldproto.py
@@ -34,7 +34,7 @@ class RAMFS_OLD:
try:
- bdev = RAMFS_OLD(48)
+ bdev = RAMFS_OLD(50)
except MemoryError:
print("SKIP")
sys.exit()
@@ -57,7 +57,3 @@ print(vfs.listdir())
# umount by device
uos.vfs_umount(bdev)
-try:
- vfs.listdir()
-except OSError as e:
- print(e.args[0] == uerrno.ENODEV)
diff --git a/tests/extmod/vfs_fat_oldproto.py.exp b/tests/extmod/vfs_fat_oldproto.py.exp
index 4120c277ac..a389a52170 100644
--- a/tests/extmod/vfs_fat_oldproto.py.exp
+++ b/tests/extmod/vfs_fat_oldproto.py.exp
@@ -1,4 +1,3 @@
['file.txt']
hello!
[]
-True
diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py
index 184672ff15..1480d52f6f 100644
--- a/tests/extmod/vfs_fat_ramdisk.py
+++ b/tests/extmod/vfs_fat_ramdisk.py
@@ -34,7 +34,7 @@ class RAMFS:
try:
- bdev = RAMFS(48)
+ bdev = RAMFS(50)
except MemoryError:
print("SKIP")
sys.exit()
@@ -46,11 +46,6 @@ print(b"hello!" not in bdev.data)
vfs = uos.VfsFat(bdev, "/ramdisk")
-try:
- vfs.statvfs("/null")
-except OSError as e:
- print(e.args[0] == uerrno.ENODEV)
-
print("statvfs:", vfs.statvfs("/ramdisk"))
print("getcwd:", vfs.getcwd())
@@ -87,15 +82,6 @@ vfs.chdir("..")
print("getcwd:", vfs.getcwd())
vfs.umount()
-try:
- vfs.listdir()
-except OSError as e:
- print(e.args[0] == uerrno.ENODEV)
-
-try:
- vfs.getcwd()
-except OSError as e:
- print(e.args[0] == uerrno.ENODEV)
vfs = uos.VfsFat(bdev, "/ramdisk")
print(vfs.listdir(b""))
diff --git a/tests/extmod/vfs_fat_ramdisk.py.exp b/tests/extmod/vfs_fat_ramdisk.py.exp
index eaf6371998..095620f178 100644
--- a/tests/extmod/vfs_fat_ramdisk.py.exp
+++ b/tests/extmod/vfs_fat_ramdisk.py.exp
@@ -1,7 +1,6 @@
True
True
-True
-statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
+statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255)
getcwd: /ramdisk
True
['foo_file.txt']
@@ -14,6 +13,4 @@ getcwd: /ramdisk/foo_dir
[]
True
getcwd: /ramdisk
-True
-True
[b'foo_file.txt', b'foo_dir']