From d99ebb310c1d6cdc87f3fa9a913149d1cd9c474a Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 9 Feb 2023 15:21:57 +1100 Subject: [PATCH] tests/extmod: Skip vfs tests if target doesn't have enough memory. Signed-off-by: Damien George --- tests/extmod/vfs_fat_fileio1.py | 2 +- tests/extmod/vfs_fat_fileio2.py | 2 +- tests/extmod/vfs_fat_ilistdir_del.py | 7 ++++++- tests/extmod/vfs_fat_ramdisk.py | 3 +-- tests/extmod/vfs_lfs_mtime.py | 7 ++++++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index c7ff9e0b98..55f399ff2e 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -38,11 +38,11 @@ class RAMFS: try: bdev = RAMFS(50) + uos.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) vfs = uos.VfsFat(bdev) uos.mount(vfs, "/ramdisk") uos.chdir("/ramdisk") diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index c7bdceb3df..9429f115f6 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -38,11 +38,11 @@ class RAMFS: try: bdev = RAMFS(50) + uos.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) vfs = uos.VfsFat(bdev) uos.mount(vfs, "/ramdisk") uos.chdir("/ramdisk") diff --git a/tests/extmod/vfs_fat_ilistdir_del.py b/tests/extmod/vfs_fat_ilistdir_del.py index a833e9ac12..4389f822bb 100644 --- a/tests/extmod/vfs_fat_ilistdir_del.py +++ b/tests/extmod/vfs_fat_ilistdir_del.py @@ -71,5 +71,10 @@ def test(bdev, vfs_class): vfs.open("/test", "w").close() -bdev = RAMBlockDevice(30) +try: + bdev = RAMBlockDevice(30) +except MemoryError: + print("SKIP") + raise SystemExit + test(bdev, uos.VfsFat) diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 0d58cec153..01235bc266 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -38,12 +38,11 @@ class RAMFS: try: bdev = RAMFS(50) + uos.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) - print(b"FOO_FILETXT" not in bdev.data) print(b"hello!" not in bdev.data) diff --git a/tests/extmod/vfs_lfs_mtime.py b/tests/extmod/vfs_lfs_mtime.py index bacdd2246c..a67e48dd80 100644 --- a/tests/extmod/vfs_lfs_mtime.py +++ b/tests/extmod/vfs_lfs_mtime.py @@ -101,5 +101,10 @@ def test(bdev, vfs_class): vfs.umount() -bdev = RAMBlockDevice(30) +try: + bdev = RAMBlockDevice(30) +except MemoryError: + print("SKIP") + raise SystemExit + test(bdev, uos.VfsLfs2)