mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
tests/extmod/vfs_lfs_error.py: Test value of all OSError's errno.
Some checks failed
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Some checks failed
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
To make sure they have the correct value. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Test for VfsLittle using a RAM device, testing error handling
|
||||
|
||||
try:
|
||||
import vfs
|
||||
import errno, vfs
|
||||
|
||||
vfs.VfsLfs1
|
||||
vfs.VfsLfs2
|
||||
@@ -41,14 +41,14 @@ def test(bdev, vfs_class):
|
||||
# mkfs with too-small block device
|
||||
try:
|
||||
vfs_class.mkfs(RAMBlockDevice(1))
|
||||
except OSError:
|
||||
print("mkfs OSError")
|
||||
except OSError as er:
|
||||
print("mkfs OSError", er.errno > 0)
|
||||
|
||||
# mount with invalid filesystem
|
||||
try:
|
||||
vfs_class(bdev)
|
||||
except OSError:
|
||||
print("mount OSError")
|
||||
except OSError as er:
|
||||
print("mount OSError", er.errno > 0)
|
||||
|
||||
# set up for following tests
|
||||
vfs_class.mkfs(bdev)
|
||||
@@ -60,60 +60,60 @@ def test(bdev, vfs_class):
|
||||
# ilistdir
|
||||
try:
|
||||
fs.ilistdir("noexist")
|
||||
except OSError:
|
||||
print("ilistdir OSError")
|
||||
except OSError as er:
|
||||
print("ilistdir OSError", er)
|
||||
|
||||
# remove
|
||||
try:
|
||||
fs.remove("noexist")
|
||||
except OSError:
|
||||
print("remove OSError")
|
||||
except OSError as er:
|
||||
print("remove OSError", er)
|
||||
|
||||
# rmdir
|
||||
try:
|
||||
fs.rmdir("noexist")
|
||||
except OSError:
|
||||
print("rmdir OSError")
|
||||
except OSError as er:
|
||||
print("rmdir OSError", er)
|
||||
|
||||
# rename
|
||||
try:
|
||||
fs.rename("noexist", "somethingelse")
|
||||
except OSError:
|
||||
print("rename OSError")
|
||||
except OSError as er:
|
||||
print("rename OSError", er)
|
||||
|
||||
# mkdir
|
||||
try:
|
||||
fs.mkdir("testdir")
|
||||
except OSError:
|
||||
print("mkdir OSError")
|
||||
except OSError as er:
|
||||
print("mkdir OSError", er)
|
||||
|
||||
# chdir to nonexistent
|
||||
try:
|
||||
fs.chdir("noexist")
|
||||
except OSError:
|
||||
print("chdir OSError")
|
||||
except OSError as er:
|
||||
print("chdir OSError", er)
|
||||
print(fs.getcwd()) # check still at root
|
||||
|
||||
# chdir to file
|
||||
try:
|
||||
fs.chdir("testfile")
|
||||
except OSError:
|
||||
print("chdir OSError")
|
||||
except OSError as er:
|
||||
print("chdir OSError", er)
|
||||
print(fs.getcwd()) # check still at root
|
||||
|
||||
# stat
|
||||
try:
|
||||
fs.stat("noexist")
|
||||
except OSError:
|
||||
print("stat OSError")
|
||||
except OSError as er:
|
||||
print("stat OSError", er)
|
||||
|
||||
# error during seek
|
||||
with fs.open("testfile", "r") as f:
|
||||
f.seek(1 << 30) # SEEK_SET
|
||||
try:
|
||||
f.seek(1 << 30, 1) # SEEK_CUR
|
||||
except OSError:
|
||||
print("seek OSError")
|
||||
except OSError as er:
|
||||
print("seek OSError", er)
|
||||
|
||||
|
||||
bdev = RAMBlockDevice(30)
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
test <class 'VfsLfs1'>
|
||||
mkfs OSError
|
||||
mount OSError
|
||||
ilistdir OSError
|
||||
remove OSError
|
||||
rmdir OSError
|
||||
rename OSError
|
||||
mkdir OSError
|
||||
chdir OSError
|
||||
mkfs OSError True
|
||||
mount OSError True
|
||||
ilistdir OSError [Errno 2] ENOENT
|
||||
remove OSError [Errno 2] ENOENT
|
||||
rmdir OSError [Errno 2] ENOENT
|
||||
rename OSError [Errno 2] ENOENT
|
||||
mkdir OSError [Errno 17] EEXIST
|
||||
chdir OSError [Errno 2] ENOENT
|
||||
/
|
||||
chdir OSError
|
||||
chdir OSError [Errno 2] ENOENT
|
||||
/
|
||||
stat OSError
|
||||
seek OSError
|
||||
stat OSError [Errno 2] ENOENT
|
||||
seek OSError [Errno 22] EINVAL
|
||||
test <class 'VfsLfs2'>
|
||||
mkfs OSError
|
||||
mount OSError
|
||||
ilistdir OSError
|
||||
remove OSError
|
||||
rmdir OSError
|
||||
rename OSError
|
||||
mkdir OSError
|
||||
chdir OSError
|
||||
mkfs OSError True
|
||||
mount OSError True
|
||||
ilistdir OSError [Errno 2] ENOENT
|
||||
remove OSError [Errno 2] ENOENT
|
||||
rmdir OSError [Errno 2] ENOENT
|
||||
rename OSError [Errno 2] ENOENT
|
||||
mkdir OSError [Errno 17] EEXIST
|
||||
chdir OSError [Errno 2] ENOENT
|
||||
/
|
||||
chdir OSError
|
||||
chdir OSError [Errno 2] ENOENT
|
||||
/
|
||||
stat OSError
|
||||
seek OSError
|
||||
stat OSError [Errno 2] ENOENT
|
||||
seek OSError [Errno 22] EINVAL
|
||||
|
||||
Reference in New Issue
Block a user