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
bd24d52e
Commit
bd24d52e
authored
May 03, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
61b173c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
t/qemu-runlinux
t/qemu-runlinux
+4
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+29
-12
No files found.
t/qemu-runlinux
View file @
bd24d52e
...
...
@@ -95,6 +95,10 @@ fi
# init part spawned from under setsid.
# $0 .qinit2 <command> ...
if
[
"
$1
"
==
.qinit2
]
;
then
# initialize terminal. In particular this has the effect to restore
# line wrapping for xterm, as kernel, initially assuming it has "linux"
# type terminal, somehow messes xterm settings.
command
-v
tput
>
/dev/null
&&
tput init
# resize terminal to current host's xterm
command
-v
resize
>
/dev/null
&&
eval
`
resize
`
...
...
wcfs/wcfs_test.py
View file @
bd24d52e
...
...
@@ -517,21 +517,21 @@ class tWatch:
# expectPin asserts that wcfs sends expected pin messages.
#
# expect
v is [] of (zf, blk, at)
# expect
is {} blk -> at
# returns [] of received pin requests.
#
# XXX cancel waiting upon receiving "ok" from wcfs (-> error that missed pins were not received)
# XXX abort on timeout?
def
expectPin
(
t
,
ctx
,
expectv
):
def
expectPin
(
t
,
ctx
,
zf
,
expect
):
expected
=
set
()
# of expected pin messages
for
zf
,
blk
,
at
in
expectv
:
for
blk
,
at
in
expect
:
msg
=
b"pin %s #%d @%s"
%
(
h
(
zf
.
_p_oid
),
blk
,
h
(
at
))
assert
msg
not
in
expected
expected
.
add
(
msg
)
reqv
=
[]
# of received requests
while
len
(
expected
)
>
0
:
req
=
t
.
recvReq
(
ctx
)
try
:
req
=
t
.
recvReq
(
ctx
)
except
Exception
as
e
:
raise
RuntimeError
(
"%s
\
n
not all pin missages received - pending:
\
n
%s"
%
(
e
,
expected
))
assert
req
is
not
None
# channel not closed
assert
req
.
msg
in
expected
expected
.
remove
(
req
.
msg
)
...
...
@@ -653,8 +653,7 @@ def test_wcfs():
wg
=
sync
.
WorkGroup
(
ctx
)
def
_
(
ctx
):
pinv
=
w
.
expectPin
(
ctx
,
[(
zf
,
2
,
at1
),
(
zf
,
3
,
at0
)])
#pinv = w.expectPin(ctx, {zf: [(2, at1), (3, at0)]}) XXX <- this way better? (sugar)
pinv
=
w
.
expectPin
(
ctx
,
zf
,
{
2
:
at1
,
3
:
at0
})
for
p
in
pinv
:
p
.
reply
(
b"ack"
)
wg
.
go
(
_
)
...
...
@@ -664,21 +663,39 @@ def test_wcfs():
wg
.
wait
()
print
(
'
\
n
CCC
\
n
'
)
bg
=
context
.
background
()
"""
# checkSetupWatch verifies setting up new watch for zf@at.
def
checkSetupWatch
(
zf
,
at
):
print
(
'check setup watch f<%s> @%s'
%
(
h
(
zf
.
_p_oid
),
h
(
at
)))
# all changes to zf
vdf
=
[
_
.
byfile
[
zf
]
for
_
in
t
.
dFtail
if
zf
in
t
.
dFtail
.
byfile
]
# changes to zf after at
vdfpost
=
[
_
for
_
in
vdf
if
_
.
rev
>
at
]
# open watch and check that we receive pins for blocks changed > at
# XXX ...
# open watch, send watch request and check that we receive pins for
# in-cache blocks changed > at.
w
=
t
.
openwatch
()
ctx
,
cancel
=
context
.
with_cancel
(
bg
)
wg
=
sync
.
WorkGroup
(
ctx
)
def
_
(
ctx
):
pinv
=
w
.
expectPin
(
ctx
,
zf
,
{})
# XXX expect=?
for
p
in
pinv
:
p
.
reply
(
b"ack"
)
wg
.
go
(
_
)
assert
w
.
sendReq
(
ctx
,
b"watch %s @%s"
%
(
h
(
zf
.
_p_oid
),
h
(
at
)))
==
"ok"
# cancel expectPin waiting upon receiving "ok" from wcfs
# -> error that missed pins were not received.
cancel
()
wg
.
wait
()
for
i
in
range
(
len
(
t
.
dFtail
)):
"""
1
/
0
return
...
...
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