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
25f5ea2f
Commit
25f5ea2f
authored
Mar 12, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
155835df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+16
-10
No files found.
wcfs/wcfs_test.py
View file @
25f5ea2f
...
...
@@ -159,6 +159,17 @@ class tDB:
raise
RuntimeError
(
"wcsync #%d: wczhead (%s) != zhead (%s)"
%
(
i
,
wchead
,
t
.
_headv
[
i
]))
t
.
_wc_zheadv
.
append
(
wchead
)
# path returns path joined with wcfs root
def
path
(
t
,
path
):
return
os
.
path
.
join
(
t
.
wc
.
mountpoint
,
path
)
# fpath returns wcfs path for file corresponding to object ID.
# By default head/... is returned. If rev != None - @<rev>/... is returned.
# XXX -> filepath? fpath?
def
filepath
(
t
,
obj
,
rev
=
None
):
head
=
"head/"
if
rev
is
None
else
(
"@%s/"
%
h
(
rev
))
return
t
.
path
(
"%s/bigfile/%s"
%
(
head
,
h
(
obj
.
_p_oid
)))
# XXX text ...
# XXX parametrize zblk0, zblk1 XXX or just rely on tox?
...
...
@@ -173,27 +184,22 @@ def test_wcfs():
tid1
=
t
.
commit
()
tid2
=
t
.
commit
()
assert
tidtime
(
tid2
)
>
tidtime
(
tid1
)
t
.
wcsync
()
# path to head/ and head/bigfile/ under wcfs
head
=
t
.
wc
.
mountpoint
+
"/head"
bigpath
=
head
+
"/bigfile"
# lookup to non-BigFile - must be rejected
with
raises
(
OSError
)
as
exc
:
os
.
stat
(
"%s/%s"
%
(
bigpath
,
h
(
nonfile
.
_p_oid
)
))
os
.
stat
(
t
.
filepath
(
nonfile
))
assert
exc
.
value
.
errno
==
EINVAL
# path to f under wcfs
fpath
=
"%s/%s"
%
(
bigpath
,
h
(
f
.
_p_oid
)
)
fpath
=
t
.
filepath
(
f
)
st
=
os
.
stat
(
fpath
)
assert
st
.
st_size
==
0
assert
st
.
st_mtime
==
tidtime
(
tid1
)
# head/at = last txn of whole db
assert
readfile
(
head
+
"/at"
)
==
h
(
tid2
)
assert
readfile
(
t
.
path
(
"head/at"
)
)
==
h
(
tid2
)
# commit data to f and make sure we can see it on wcfs
...
...
@@ -214,7 +220,7 @@ def test_wcfs():
st
=
os
.
stat
(
fpath
)
assert
st
.
st_size
==
fsize
assert
st
.
st_mtime
==
tidtime
(
t
.
head
)
assert
readfile
(
head
+
"/at"
)
==
h
(
t
.
head
)
assert
readfile
(
t
.
path
(
"head/at"
)
)
==
h
(
t
.
head
)
data
=
readfile
(
fpath
)
assert
len
(
data
)
==
fsize
...
...
@@ -245,7 +251,7 @@ def test_wcfs():
st
=
os
.
stat
(
fpath
)
assert
st
.
st_size
==
fsize
assert
st
.
st_mtime
==
tidtime
(
t
.
head
)
assert
readfile
(
head
+
"/at"
)
==
h
(
t
.
head
)
assert
readfile
(
t
.
path
(
"head/at"
)
)
==
h
(
t
.
head
)
data
=
readfile
(
fpath
)
assert
len
(
data
)
==
fsize
...
...
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