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
efc51ca2
Commit
efc51ca2
authored
Mar 28, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8c7ee360
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
24 deletions
+9
-24
wcfs/test.sh
wcfs/test.sh
+1
-1
wcfs/wcfs.go
wcfs/wcfs.go
+1
-1
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+7
-22
No files found.
wcfs/test.sh
View file @
efc51ca2
...
...
@@ -8,5 +8,5 @@ if test -z "$qrun_loglevel"; then
fi
# executed under qemu-runlinux
export
WENDELIN_CORE_WCFS_OPTIONS
=
"-d -alsologtostderr -v=1"
#
export WENDELIN_CORE_WCFS_OPTIONS="-d -alsologtostderr -v=1"
py.test
-vsx
-k
test_wcfs
wcfs/wcfs.go
View file @
efc51ca2
...
...
@@ -1300,7 +1300,7 @@ func (w *Watcher) _serve() (err error) {
return
err
// XXX err ctx?
}
fmt
.
Printf
(
"watch: rx: %q
\n
"
,
l
)
fmt
.
Printf
(
"
S:
watch: rx: %q
\n
"
,
l
)
stream
,
msg
,
err
:=
parseWatchFrame
(
l
)
if
err
!=
nil
{
...
...
wcfs/wcfs_test.py
View file @
efc51ca2
...
...
@@ -187,7 +187,7 @@ class tDB:
wchead
=
fromhex
(
l
)
i
=
len
(
t
.
_wc_zheadv
)
if
wchead
!=
t
.
_headv
[
i
]:
raise
RuntimeError
(
"wcsync #%d: wczhead (%s) != zhead (%s)"
%
(
i
,
wchead
,
t
.
_headv
[
i
]
))
raise
RuntimeError
(
"wcsync #%d: wczhead (%s) != zhead (%s)"
%
(
i
,
h
(
wchead
),
h
(
t
.
_headv
[
i
])
))
t
.
_wc_zheadv
.
append
(
wchead
)
# head/at = last txn of whole db
...
...
@@ -409,7 +409,7 @@ class tWatch:
defer
(
t
.
_serveDone
.
close
)
while
1
:
l
=
t
.
wrx
.
readline
()
print
(
'watch: rx: %r'
%
l
)
print
(
'
C:
watch: rx: %r'
%
l
)
if
len
(
l
)
==
0
:
break
# closed
...
...
@@ -433,41 +433,30 @@ class tWatch:
#
# multiple _send can be called in parallel - _send serializes writes.
def
_send
(
t
,
stream
,
msg
):
print
(
'qqq'
)
assert
'
\
n
'
not
in
msg
print
(
'zzz'
)
with
t
.
_txmu
:
print
(
'rrr'
)
a
=
b"%d %s
\
n
"
%
(
stream
,
msg
)
print
(
`a`
)
t
.
wtx
.
write
(
b"%d %s
\
n
"
%
(
stream
,
msg
))
# XXX read/write don't work in parallel?
print
(
'sss'
)
t
.
wtx
.
flush
()
print
(
'ooo'
)
# sendReq sends client -> server request and returns server reply.
#
# only 1 sendReq must be used at a time. # XXX relax?
def
sendReq
(
t
,
req
):
print
(
"000"
)
stream
=
1
rxq
=
chan
()
print
(
"111"
)
with
t
.
_rxmu
:
print
(
"222"
)
assert
stream
not
in
t
.
_rxtab
t
.
_rxtab
[
stream
]
=
rxq
print
(
"333"
)
t
.
_send
(
stream
,
req
)
print
(
"444"
)
return
rxq
.
recv
()
# recvReq receives client <- server request.
#
# multiple recvReq could be used at a time.
def
recvReq
(
t
):
# -> tSrvReq
def
recvReq
(
t
):
# -> tSrvReq
| None when EOF
rx
=
t
.
_acceptq
.
recv
()
if
rx
is
None
:
return
rx
...
...
@@ -476,7 +465,7 @@ class tWatch:
return
tSrvReq
(
t
,
stream
,
msg
)
# expectPin
... XXX
# expectPin
asserts that wcfs sends expected pin messages.
#
# expectv is [] of (zf, blk, at)
# returns [] of received pin requests.
...
...
@@ -490,6 +479,7 @@ class tWatch:
reqv
=
[]
# of received requests
while
len
(
expected
)
>
0
:
req
=
t
.
recvReq
()
assert
req
is
not
None
assert
req
.
msg
in
expected
expected
.
delete
(
req
.
msg
)
reqv
.
append
(
req
)
...
...
@@ -607,7 +597,6 @@ def test_wcfs():
# XXX invalidation protocol ...
print
(
'
\
n
\
n
'
)
w
=
t
.
openwatch
()
done
=
chan
()
...
...
@@ -615,15 +604,11 @@ def test_wcfs():
def
_
():
defer
(
done
.
close
)
pinv
=
w
.
expectPin
([(
zf
,
2
,
at1
),
(
zf
,
3
,
at1
)])
#pinv = w.expectPin({zf: [(2, at1), (3, at1)]}) XXX <- this way better? (sugar)
for
p
in
pinv
:
p
.
ack
()
go
(
_
)
print
(
'
\
n
AAA
\
n
'
)
try
:
assert
w
.
sendReq
(
b"watch %s @%s"
%
(
h
(
zf
.
_p_oid
),
h
(
at1
)))
==
"ok"
except
Exception
,
e
:
print
(
e
)
raise
assert
w
.
sendReq
(
b"watch %s @%s"
%
(
h
(
zf
.
_p_oid
),
h
(
at1
)))
==
"ok"
print
(
'
\
n
BBB
\
n
'
)
done
.
recv
()
print
(
'
\
n
CCC
\
n
'
)
...
...
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