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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
5d7f9718
Commit
5d7f9718
authored
Jun 07, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8689314b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+14
-9
No files found.
wcfs/wcfs_test.py
View file @
5d7f9718
...
...
@@ -839,7 +839,7 @@ def _watch(twlink, zf, at, pinok, replyok):
wg.wait()
"""
def
_
(
ctx
):
def
_
(
ctx
,
ev
):
reply
=
twlink
.
sendReq
(
ctx
,
b"watch %s @%s"
%
(
h
(
zf
.
_p_oid
),
h
(
at
)))
if
replyok
.
endswith
(
'…'
):
rok
=
replyok
[:
-
len
(
'…'
)]
...
...
@@ -854,13 +854,13 @@ def _watch(twlink, zf, at, pinok, replyok):
# doCheckingPin calls f and verifies that wcfs sends expected pins during the
# time f executes.
#
# f(ctx
) # XXX + ev?
# f(ctx
, eventv)
# pinokByWLink: {} tWatchLink -> (zf, {} blk -> at).
# pinfunc(wlink, foid, blk, at) | None. XXX foid -> ZBigFile?
#
# pinfunc is called after pin request is received from wcfs but before pin ack
# is replied back. pinfunc must not block.
def
doCheckingPin
(
f
,
pinokByWLink
,
pinfunc
=
None
):
def
doCheckingPin
(
f
,
pinokByWLink
,
pinfunc
=
None
):
# -> []event(str)
# call f and check that we receive pins as specified.
# Use timeout to detect wcfs replying less pins than expected.
#
...
...
@@ -869,14 +869,18 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None):
# we did not received expeced pin when wcfs sends final ok?
ctx
,
cancel
=
with_timeout
()
wg
=
sync
.
WorkGroup
(
ctx
)
ev
=
[]
for
wlink
,
(
zf
,
pinok
)
in
pinokByWLink
.
items
():
def
_
(
ctx
,
wlink
):
pinv
=
wlink
.
_expectPin
(
ctx
,
zf
,
pinok
)
ev
.
append
(
'pin rx'
)
# XXX + zf, pin details?
tdelay
()
# increase probability to receive erroneous extra pins
for
p
in
pinv
:
if
pinfunc
is
not
None
:
if
pinfunc
is
not
None
:
for
p
in
pinv
:
pinfunc
(
wlink
,
p
.
foid
,
p
.
blk
,
p
.
at
)
ev
.
append
(
'pin ack pre'
)
# XXX +details?
for
p
in
pinv
:
p
.
reply
(
b"ack"
)
# check that we don't get extra pins before reply to "watch"
try
:
...
...
@@ -890,13 +894,15 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None):
wg
.
go
(
_
,
wlink
)
def
_
(
ctx
):
f
(
ctx
)
f
(
ctx
,
ev
)
# cancel _expectPin waiting upon completing f
# -> error that missed pins were not received.
cancel
()
wg
.
go
(
_
)
wg
.
wait
()
return
ev
# _expectPin asserts that wcfs sends expected pin messages.
#
...
...
@@ -1067,8 +1073,7 @@ def test_wcfs():
blk_data
=
f
.
blk
(
blk
)
assert
f
.
cached
()[
blk
]
==
0
ev
=
[]
def
_
(
ctx
):
def
_
(
ctx
,
ev
):
assert
f
.
cached
()[
blk
]
==
0
ev
.
append
(
'read pre'
)
...
...
@@ -1090,7 +1095,7 @@ def test_wcfs():
b
=
_rx
ev
.
append
(
'read '
+
chr
(
b
))
doCheckingPin
(
_
,
{
wl
:
(
zf
,
pinok
)})
ev
=
doCheckingPin
(
_
,
{
wl
:
(
zf
,
pinok
)})
"""
...
...
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