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
508a3d71
Commit
508a3d71
authored
Jun 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0a125d3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+19
-7
No files found.
wcfs/wcfs_test.py
View file @
508a3d71
...
@@ -532,7 +532,7 @@ class tFile:
...
@@ -532,7 +532,7 @@ class tFile:
assert
wpin
==
pinokByWLink
,
"computed vs explicit pinokByWLink"
assert
wpin
==
pinokByWLink
,
"computed vs explicit pinokByWLink"
pinokByWLink
=
wpin
pinokByWLink
=
wpin
# doCheckingPin expect every wlink entry to also contain zf
# doCheckingPin expect
s
every wlink entry to also contain zf
for
wlink
,
pinok
in
pinokByWLink
.
items
():
for
wlink
,
pinok
in
pinokByWLink
.
items
():
pinokByWLink
[
wlink
]
=
(
t
.
zf
,
pinok
)
pinokByWLink
[
wlink
]
=
(
t
.
zf
,
pinok
)
...
@@ -606,7 +606,7 @@ class tFile:
...
@@ -606,7 +606,7 @@ class tFile:
# tWatch represents watch for one file setup on a tWatchLink.
# tWatch represents watch for one file setup on a tWatchLink.
class
tWatch
:
class
tWatch
:
def
__init__
(
w
):
def
__init__
(
w
):
w
.
at
=
None
# None only initially - always concrete after setup
w
.
at
=
z64
# not None - always concrete
w
.
pinned
=
{}
# blk -> rev
w
.
pinned
=
{}
# blk -> rev
# tWatchLink provides testing environment for /head/watch link opened on wcfs.
# tWatchLink provides testing environment for /head/watch link opened on wcfs.
...
@@ -876,9 +876,11 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
...
@@ -876,9 +876,11 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
t
=
twlink
.
tdb
t
=
twlink
.
tdb
w
=
twlink
.
_watching
.
get
(
zf
)
w
=
twlink
.
_watching
.
get
(
zf
)
if
w
is
None
:
if
w
is
None
:
w
=
tWatch
()
w
=
twlink
.
_watching
[
zf
]
=
tWatch
()
at_prev
=
None
else
:
at_prev
=
w
.
at
# we were previously watching zf @at_prev
at_prev
=
w
.
at
# we were previously watching zf @at_prev
at_from
=
''
at_from
=
''
if
at_prev
is
not
None
:
if
at_prev
is
not
None
:
at_from
=
'(%s ->) '
%
t
.
hat
(
at_prev
)
at_from
=
'(%s ->) '
%
t
.
hat
(
at_prev
)
...
@@ -939,7 +941,6 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
...
@@ -939,7 +941,6 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
w
.
at
=
at
w
.
at
=
at
# XXX update pinned
# XXX update pinned
twlink
.
_watching
[
zf
]
=
w
# _watch sends watch request for zf@at, expects initial pins specified by pinok and final reply.
# _watch sends watch request for zf@at, expects initial pins specified by pinok and final reply.
#
#
...
@@ -979,7 +980,11 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
...
@@ -979,7 +980,11 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
ev
=
[]
ev
=
[]
for
wlink
,
(
zf
,
pinok
)
in
pinokByWLink
.
items
():
for
wlink
,
(
zf
,
pinok
)
in
pinokByWLink
.
items
():
def
_
(
ctx
,
wlink
):
def
_
(
ctx
,
wlink
,
zf
,
pinok
):
w
=
wlink
.
_watching
.
get
(
zf
)
if
len
(
pinok
)
>
0
:
assert
w
is
not
None
pinv
=
wlink
.
_expectPin
(
ctx
,
zf
,
pinok
)
pinv
=
wlink
.
_expectPin
(
ctx
,
zf
,
pinok
)
if
len
(
pinv
)
>
0
:
if
len
(
pinv
)
>
0
:
ev
.
append
(
'pin rx'
)
# XXX + zf, pin details?
ev
.
append
(
'pin rx'
)
# XXX + zf, pin details?
...
@@ -993,6 +998,13 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
...
@@ -993,6 +998,13 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
pinfunc
(
wlink
,
p
.
foid
,
p
.
blk
,
p
.
at
)
pinfunc
(
wlink
,
p
.
foid
,
p
.
blk
,
p
.
at
)
ev
.
append
(
'pin ack pre'
)
# XXX +details?
ev
.
append
(
'pin ack pre'
)
# XXX +details?
for
p
in
pinv
:
for
p
in
pinv
:
assert
w
.
foid
==
p
.
foid
if
p
.
at
is
None
:
# repin to @head
assert
p
.
blk
in
w
.
pinned
# must have been pinned before XXX correct?
del
w
.
pinned
[
p
.
blk
]
else
:
w
.
pinned
[
p
.
blk
]
=
p
.
at
p
.
reply
(
b"ack"
)
p
.
reply
(
b"ack"
)
# check that we don't get extra pins before f completes
# check that we don't get extra pins before f completes
...
@@ -1004,7 +1016,7 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
...
@@ -1004,7 +1016,7 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
reraise
(
e
,
None
,
e
.
__traceback__
)
reraise
(
e
,
None
,
e
.
__traceback__
)
assert
False
,
"extra pin message received: %r"
%
req
.
msg
assert
False
,
"extra pin message received: %r"
%
req
.
msg
wg
.
go
(
_
,
wlink
)
wg
.
go
(
_
,
wlink
,
zf
,
pinok
)
def
_
(
ctx
):
def
_
(
ctx
):
f
(
ctx
,
ev
)
f
(
ctx
,
ev
)
...
...
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