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
9a3b7413
Commit
9a3b7413
authored
Jun 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
12a3a4d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+25
-17
No files found.
wcfs/wcfs_test.py
View file @
9a3b7413
...
...
@@ -582,7 +582,8 @@ class tFile:
# assertData asserts that file has data blocks as specified.
#
# Expected blocks may be given with size < zf.blksize. In such case they
# are implicitly appended with trailing zeros.
# are implicitly appended with trailing zeros. If a block is specified as
# 'x' - this particular block is not checked.
#
# It also checks file size and optionally mtime.
def
assertData
(
t
,
dataokv
,
mtime
=
None
):
...
...
@@ -591,11 +592,15 @@ class tFile:
if
mtime
is
not
None
:
assert
st
.
st_mtime
==
tidtime
(
mtime
)
cachev
=
t
.
cached
()
for
blk
,
dataok
in
enumerate
(
dataokv
):
if
dataok
==
'x'
:
continue
t
.
assertBlk
(
blk
,
dataok
)
cachev
[
blk
]
=
1
# all blocks must be in cache after we touched them all
t
.
assertCache
(
[
1
]
*
len
(
dataokv
)
)
# all
accessed
blocks must be in cache after we touched them all
t
.
assertCache
(
cachev
)
# tWatch represents watch for one file setup on a tWatchLink.
...
...
@@ -1201,12 +1206,14 @@ def test_wcfs():
f
.
assertData
([
''
,
''
,
'c1'
],
mtime
=
t
.
head
)
# >>> (@at2) commit again -> we can see both latest and snapshotted states
t
.
change
(
zf
,
{
2
:
'c2'
,
3
:
'd2'
})
# NOTE blocks d(4) and f(5) will be not yet accessed till "watch+commit" test phase
t
.
change
(
zf
,
{
2
:
'c2'
,
3
:
'd2'
,
5
:
'f2'
})
at2
=
t
.
commit
()
# f @head
f
.
assertCache
([
1
,
1
,
0
,
0
])
f
.
assertData
([
''
,
''
,
'c2'
,
'd2'
],
mtime
=
t
.
head
)
f
.
assertCache
([
1
,
1
,
0
,
0
,
0
,
0
])
f
.
assertData
([
''
,
''
,
'c2'
,
'd2'
,
'x'
,
'x'
],
mtime
=
t
.
head
)
f
.
assertCache
([
1
,
1
,
1
,
1
,
0
,
0
])
# f @at1
f1
=
t
.
open
(
zf
,
at
=
at1
)
...
...
@@ -1219,21 +1226,22 @@ def test_wcfs():
t
.
change
(
zf
,
{
2
:
'c3'
})
# FIXME + a3 after δbtree works (hole -> zblk)
at3
=
t
.
commit
()
f
.
assertCache
([
1
,
1
,
0
,
1
])
f
.
assertCache
([
1
,
1
,
0
,
1
,
0
,
0
])
# f @head is opened again -> cache must not be lost
f_
=
t
.
open
(
zf
)
f_
.
assertCache
([
1
,
1
,
0
,
1
])
f_
.
assertCache
([
1
,
1
,
0
,
1
,
0
,
0
])
f_
.
close
()
f
.
assertCache
([
1
,
1
,
0
,
1
])
f
.
assertCache
([
1
,
1
,
0
,
1
,
0
,
0
])
# f @head
f
.
assertCache
([
1
,
1
,
0
,
1
])
f
.
assertData
([
''
,
''
,
'c3'
,
'd2'
],
mtime
=
t
.
head
)
f
.
assertCache
([
1
,
1
,
0
,
1
,
0
,
0
])
f
.
assertData
([
''
,
''
,
'c3'
,
'd2'
,
'x'
,
'x'
],
mtime
=
t
.
head
)
# f @at2
f2
.
assertCache
([
0
,
0
,
1
,
0
])
f2
.
assertData
([
''
,
''
,
'c2'
,
'd2'
])
# XXX mtime=at2?
# NOTE f2 is accessed but via @at/ not head/
f2
.
assertCache
([
0
,
0
,
1
,
0
,
0
,
0
])
f2
.
assertData
([
''
,
''
,
'c2'
,
'd2'
,
''
,
'f2'
])
# XXX mtime=at2?
# f @at1
f1
.
assertCache
([
1
,
1
,
1
])
...
...
@@ -1242,10 +1250,10 @@ def test_wcfs():
# >>> f close / open again -> cache must not be lost
# XXX a bit flaky since OS can evict whole f cache under pressure
f
.
assertCache
([
1
,
1
,
1
,
1
])
f
.
assertCache
([
1
,
1
,
1
,
1
,
0
,
0
])
f
.
close
()
f
=
t
.
open
(
zf
)
if
f
.
cached
()
!=
[
1
,
1
,
1
,
1
]:
if
f
.
cached
()
!=
[
1
,
1
,
1
,
1
,
0
,
0
]:
assert
sum
(
f
.
cached
())
>
4
*
1
/
2
# > 50%
# >>> XXX commit data to not yet accessed f part - nothing happens
...
...
@@ -1349,7 +1357,7 @@ def test_wcfs():
assert
w3_
.
pinned
==
pinw3_
assert
w2
.
pinned
==
pinw2
f
.
assertCache
([
1
,
1
,
1
,
1
])
f
.
assertCache
([
1
,
1
,
1
,
1
,
0
,
0
])
# XXX move f4 commit ^^^ (where watch with explicit pinok is tested)
t
.
change
(
zf
,
{
2
:
'c4'
,
5
:
'f4'
,
6
:
'g4'
})
# FIXME + b4 after δbtree works + update vvv
at4
=
t
.
commit
()
...
...
@@ -1459,7 +1467,7 @@ def test_wcfs():
# XXX ZBlk moved from blk1 -> blk2 ; for the same file and for file1 -> file2 (δbtree)
# XXX read file[blk]=hole; then file[blk]=zblk - must be invalidated and
# setupWatch must send pins. (δbtree - see e.g. commit
with
b4 ^^^)
# setupWatch must send pins. (δbtree - see e.g. commit
s with a3,
b4 ^^^)
# ---- misc ---
...
...
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