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
727946ee
Commit
727946ee
authored
Apr 13, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1d9b44e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
wcfs/testdata/zblk_test_gen.py
wcfs/testdata/zblk_test_gen.py
+10
-9
No files found.
wcfs/testdata/zblk_test_gen.py
View file @
727946ee
...
...
@@ -32,10 +32,6 @@ from zodbtools.test.gen_testdata import run_with_zodb3py2_compat
K
=
1024
def
rm_f
(
path
):
if
os
.
path
.
exists
(
path
):
os
.
remove
(
path
)
def
main
():
run_with_zodb3py2_compat
(
main2
)
...
...
@@ -47,10 +43,10 @@ def main2():
conn
=
db
.
open
()
root
=
conn
.
root
()
# one ZBigFile with two data blocks
root
[
'zbigf'
]
=
zf
=
ZBigFile
(
2
*
1024
*
K
)
root
[
'zblk0'
]
=
z0
=
ZBlk0
()
root
[
'zblk1'
]
=
z1
=
ZBlk1
()
# also covers ZData
root
[
'zbigf'
]
=
zf
=
ZBigFile
(
2
*
1024
*
K
)
# zblk0 with small data
z0
.
setblkdata
(
brange32
(
16
*
K
))
...
...
@@ -61,11 +57,11 @@ def main2():
zf
.
blktab
[
0
]
=
z0
zf
.
blktab
[
1
]
=
z1
# make sure there is at least one bucket in
Z
1's chunktab
# make sure there is at least one bucket in
z
1's chunktab
#
# we need at least one bucket to verify how zblk.go handles chunktab bucket loading;
# more than 1 bucket just wastes space, however with only 1 bucket a tree
# is serialized to have leaf nodes diectly in the tree state.
# is serialized to have leaf nodes di
r
ectly in the tree state.
# -> verify for ==2 buckets.
assertIOBTreeHas2Buckets
(
z1
.
chunktab
)
...
...
@@ -92,7 +88,7 @@ def main2():
db
.
close
()
# brange32 returns bytes with big-endian uint32 seqence filling them.
# brange32 returns bytes with big-endian uint32 seq
u
ence filling them.
# returned bytes has len == size.
def
brange32
(
size
):
# 0, 1, 2, ... as u32
...
...
@@ -122,6 +118,11 @@ def assertIOBTreeHas2Buckets(t):
assert
isinstance
(
_
[
0
][
2
],
IOBucket
),
_
[
0
][
2
]
# bucket1
assert
isinstance
(
_
[
1
],
IOBucket
),
_
[
1
]
# .firstbucket
# rm_f is like `rm -f` in shell.
def
rm_f
(
path
):
if
os
.
path
.
exists
(
path
):
os
.
remove
(
path
)
if
__name__
==
'__main__'
:
main
()
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