Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
677ebcb1
Commit
677ebcb1
authored
Jun 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
11f0976e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
7 deletions
+39
-7
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+39
-7
No files found.
wcfs/wcfs_test.py
View file @
677ebcb1
...
...
@@ -495,9 +495,13 @@ class tFile:
if
not
isinstance
(
dataok
,
bytes
):
dataok
=
dataok
.
encode
(
'utf-8'
)
assert
len
(
dataok
)
<=
t
.
blksize
blkdata
,
blkrev
=
t
.
tdb
.
_blkDataAt
(
t
.
zf
,
blk
,
t
.
at
)
blkdata
,
_
=
t
.
tdb
.
_blkDataAt
(
t
.
zf
,
blk
,
t
.
at
)
assert
blkdata
==
dataok
,
"computed vs explicit data"
t
.
_assertBlk
(
blk
,
dataok
,
pinokByWLink
)
@
func
def
_assertBlk
(
t
,
blk
,
dataok
,
pinokByWLink
=
None
,
pinfunc
=
None
):
assert
len
(
dataok
)
<=
t
.
blksize
dataok
+=
b'
\
0
'
*
(
t
.
blksize
-
len
(
dataok
))
# tailing zeros
assert
blk
<
t
.
_sizeinblk
()
...
...
@@ -516,6 +520,7 @@ class tFile:
# watches that must be notified if access goes to @head/file
wpin
=
{}
# tWatchLink -> pinok
blkrev
=
t
.
tdb
.
_blkRevAt
(
t
.
zf
,
blk
,
t
.
at
)
if
t
.
at
is
None
:
# @head/...
for
wlink
in
t
.
tdb
.
_wlinks
:
pinok
=
{}
...
...
@@ -570,7 +575,7 @@ class tFile:
b
=
_rx
ev
.
append
(
'read '
+
b
)
ev
=
doCheckingPin
(
_
,
pinokByWLink
)
ev
=
doCheckingPin
(
_
,
pinokByWLink
,
pinfunc
)
# XXX hack - wlinks are notified and emit events simultaneously - we
# check only that events begin and end with read pre/post and that pins
...
...
@@ -589,7 +594,7 @@ class tFile:
# verify full data of the block
# XXX assert individually for every block's page? (easier debugging?)
assert
blkview
==
dataok
assert
blkview
.
tobytes
()
==
dataok
# we just accessed the block in full - it has to be in OS cache completely
assert
t
.
cached
()[
blk
]
==
1
...
...
@@ -1386,7 +1391,7 @@ def test_wcfs_watch_setup():
# verify that already setup watch(es) receive correct pins on block access.
@
func
def
test_wcfs_watch_vs_
commit
():
# XXX commit -> access ?
def
test_wcfs_watch_vs_
access
():
t
=
tDB
();
zf
=
t
.
zfile
;
at0
=
t
.
at0
defer
(
t
.
close
)
...
...
@@ -1503,14 +1508,41 @@ def test_wcfs_watch_vs_commit(): # XXX commit -> access ?
wl3
.
close
()
# verify that on pin message, while under pagefault, we can mmap @at/f[blk]
# into where head/f[blk] was mmaped.
@
func
def
test_wcfs_remmap_on_pin
():
t
=
tDB
();
zf
=
t
.
zfile
defer
(
t
.
close
)
at1
=
t
.
commit
(
zf
,
{
2
:
'hello'
})
at2
=
t
.
commit
(
zf
,
{
2
:
'world'
})
f
=
t
.
open
(
zf
)
f1
=
t
.
open
(
zf
,
at
=
at1
)
wl
=
t
.
openwatch
()
wl
.
watch
(
zf
,
at1
,
{})
f
.
assertCache
([
0
,
0
,
0
])
def
_
(
wlink
,
foid
,
blk
,
at
):
assert
wlink
is
wl
assert
foid
==
zf
.
_p_oid
assert
blk
==
2
assert
at
==
at1
mm
.
map_into_ro
(
f
.
_blk
(
blk
),
f1
.
f
.
fileno
(),
blk
*
f
.
blksize
)
f
.
_assertBlk
(
2
,
'hello'
,
{
wl
:
{
2
:
at1
}},
pinfunc
=
_
)
# NOTE not world
# XXX drop file[blk] from cache, access again -> no pin message sent the second time
# XXX watch with @at > head - must wait for head to become >= at
# XXX no reply to pin - killed
# XXX mmap f; remmap f[blk] on pin message while under pagefault - should get changed page
# XXX watch @at when file did not existed -> error
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment