Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
e42186d3
Commit
e42186d3
authored
8 years ago
by
Alex March
Committed by
Paul Sokolovsky
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tests/extmod/vfs_fat: Replace asserts with prints and expected outputs.
parent
f2f8ae11
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/extmod/vfs_fat_ramdisk.py
+13
-15
13 additions, 15 deletions
tests/extmod/vfs_fat_ramdisk.py
tests/extmod/vfs_fat_ramdisk.py.exp
+13
-0
13 additions, 0 deletions
tests/extmod/vfs_fat_ramdisk.py.exp
with
26 additions
and
15 deletions
tests/extmod/vfs_fat_ramdisk.py
+
13
−
15
View file @
e42186d3
...
@@ -41,8 +41,8 @@ except MemoryError:
...
@@ -41,8 +41,8 @@ except MemoryError:
uos
.
VfsFat
.
mkfs
(
bdev
)
uos
.
VfsFat
.
mkfs
(
bdev
)
assert
b
"
FOO_FILETXT
"
not
in
bdev
.
data
print
(
b
"
FOO_FILETXT
"
not
in
bdev
.
data
)
assert
b
"
hello!
"
not
in
bdev
.
data
print
(
b
"
hello!
"
not
in
bdev
.
data
)
vfs
=
uos
.
VfsFat
(
bdev
,
"
/ramdisk
"
)
vfs
=
uos
.
VfsFat
(
bdev
,
"
/ramdisk
"
)
print
(
"
statvfs:
"
,
vfs
.
statvfs
(
"
/ramdisk
"
))
print
(
"
statvfs:
"
,
vfs
.
statvfs
(
"
/ramdisk
"
))
...
@@ -57,10 +57,10 @@ f2 = vfs.open("foo_file.txt")
...
@@ -57,10 +57,10 @@ f2 = vfs.open("foo_file.txt")
print
(
f2
.
read
())
print
(
f2
.
read
())
f2
.
close
()
f2
.
close
()
assert
b
"
FOO_FILETXT
"
in
bdev
.
data
print
(
b
"
FOO_FILETXT
"
in
bdev
.
data
)
assert
b
"
hello!
"
in
bdev
.
data
print
(
b
"
hello!
"
in
bdev
.
data
)
assert
vfs
.
listdir
()
==
[
'
foo_file.txt
'
]
print
(
vfs
.
listdir
()
)
try
:
try
:
vfs
.
rmdir
(
"
foo_file.txt
"
)
vfs
.
rmdir
(
"
foo_file.txt
"
)
...
@@ -68,10 +68,10 @@ except OSError as e:
...
@@ -68,10 +68,10 @@ except OSError as e:
print
(
e
.
args
[
0
]
==
20
)
# uerrno.ENOTDIR
print
(
e
.
args
[
0
]
==
20
)
# uerrno.ENOTDIR
vfs
.
remove
(
'
foo_file.txt
'
)
vfs
.
remove
(
'
foo_file.txt
'
)
assert
vfs
.
listdir
()
==
[]
print
(
vfs
.
listdir
()
)
vfs
.
mkdir
(
"
foo_dir
"
)
vfs
.
mkdir
(
"
foo_dir
"
)
assert
vfs
.
listdir
()
==
[
'
foo_dir
'
]
print
(
vfs
.
listdir
()
)
try
:
try
:
vfs
.
remove
(
"
foo_dir
"
)
vfs
.
remove
(
"
foo_dir
"
)
...
@@ -82,18 +82,18 @@ f = vfs.open("foo_dir/file-in-dir.txt", "w")
...
@@ -82,18 +82,18 @@ f = vfs.open("foo_dir/file-in-dir.txt", "w")
f
.
write
(
"
data in file
"
)
f
.
write
(
"
data in file
"
)
f
.
close
()
f
.
close
()
assert
vfs
.
listdir
(
"
foo_dir
"
)
==
[
'
file-in-dir.txt
'
]
print
(
vfs
.
listdir
(
"
foo_dir
"
)
)
vfs
.
rename
(
"
foo_dir/file-in-dir.txt
"
,
"
moved-to-root.txt
"
)
vfs
.
rename
(
"
foo_dir/file-in-dir.txt
"
,
"
moved-to-root.txt
"
)
assert
vfs
.
listdir
()
==
[
'
foo_dir
'
,
'
moved-to-root.txt
'
]
print
(
vfs
.
listdir
()
)
vfs
.
chdir
(
"
foo_dir
"
)
vfs
.
chdir
(
"
foo_dir
"
)
print
(
"
getcwd:
"
,
vfs
.
getcwd
())
print
(
"
getcwd:
"
,
vfs
.
getcwd
())
assert
vfs
.
listdir
()
==
[]
print
(
vfs
.
listdir
()
)
with
vfs
.
open
(
"
sub_file.txt
"
,
"
w
"
)
as
f
:
with
vfs
.
open
(
"
sub_file.txt
"
,
"
w
"
)
as
f
:
f
.
write
(
"
test2
"
)
f
.
write
(
"
test2
"
)
assert
vfs
.
listdir
()
==
[
"
sub_file.txt
"
]
print
(
vfs
.
listdir
()
)
try
:
try
:
vfs
.
chdir
(
"
sub_file.txt
"
)
vfs
.
chdir
(
"
sub_file.txt
"
)
...
@@ -116,9 +116,7 @@ vfs.umount()
...
@@ -116,9 +116,7 @@ vfs.umount()
try
:
try
:
vfs
.
listdir
()
vfs
.
listdir
()
except
OSError
as
e
:
except
OSError
as
e
:
assert
e
.
args
[
0
]
==
uerrno
.
ENODEV
print
(
e
.
args
[
0
]
==
uerrno
.
ENODEV
)
else
:
raise
AssertionError
(
"
expected OSError not thrown
"
)
vfs
=
uos
.
VfsFat
(
bdev
,
"
/ramdisk
"
)
vfs
=
uos
.
VfsFat
(
bdev
,
"
/ramdisk
"
)
assert
vfs
.
listdir
()
==
[
'
moved-to-root.txt
'
]
print
(
vfs
.
listdir
()
)
This diff is collapsed.
Click to expand it.
tests/extmod/vfs_fat_ramdisk.py.exp
+
13
−
0
View file @
e42186d3
True
True
statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
getcwd: /ramdisk
getcwd: /ramdisk
hello!
hello!
True
True
True
True
['foo_file.txt']
True
[]
['foo_dir']
True
['file-in-dir.txt']
['foo_dir', 'moved-to-root.txt']
getcwd: /ramdisk/foo_dir
getcwd: /ramdisk/foo_dir
[]
['sub_file.txt']
True
True
getcwd: /ramdisk
getcwd: /ramdisk
True
True
['moved-to-root.txt']
['moved-to-root.txt']
True
['moved-to-root.txt']
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment