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
595afd6a
Commit
595afd6a
authored
Jun 23, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f30826a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
42 deletions
+11
-42
wcfs/internal/xbtree/testprog/treegen.py
wcfs/internal/xbtree/testprog/treegen.py
+1
-1
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+10
-41
No files found.
wcfs/internal/xbtree/testprog/treegen.py
View file @
595afd6a
...
...
@@ -20,7 +20,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
"""Program treegen provides infrastructure to generate ZODB BTree states.
It is used as helper for ΔB
Tree
tests.
It is used as helper for ΔB
tail
tests.
The following subcommands are provided:
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
595afd6a
...
...
@@ -300,13 +300,13 @@ func (rbs RBucketSet) coverage() string {
return
s
}
// trackSet returns what should be ΔBt
ree
.trackSet coverage for specified tracked key set.
// trackSet returns what should be ΔBt
ail
.trackSet coverage for specified tracked key set.
func
(
rbs
RBucketSet
)
trackSet
(
tracked
SetKey
)
PPTreeSubSet
{
trackSet
,
_
:=
rbs
.
trackSetWithCov
(
tracked
)
return
trackSet
}
// trackSetWithCov returns what should be ΔBt
ree
.trackSet and its key coverage for specified tracked key set.
// trackSetWithCov returns what should be ΔBt
ail
.trackSet and its key coverage for specified tracked key set.
func
(
rbs
RBucketSet
)
trackSetWithCov
(
tracked
SetKey
)
(
trackSet
PPTreeSubSet
,
keyCover
*
RangedKeySet
)
{
trackSet
=
PPTreeSubSet
{}
keyCover
=
&
RangedKeySet
{}
...
...
@@ -1121,7 +1121,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
})
}
// xverifyΔBTail_rebuild_U verifies ΔB
Tree
state after Update(ti->tj).
// xverifyΔBTail_rebuild_U verifies ΔB
tail
state after Update(ti->tj).
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
X
:=
exc
.
Raiseif
...
...
@@ -1137,7 +1137,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, db *zodb.DB, treeR
assertΔTtail
(
t
,
subj
,
δbtail
,
db
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
}
// xverifyΔBTail_rebuild_TR verifies ΔB
Tree
state after Track(keys) + rebuild.
// xverifyΔBTail_rebuild_TR verifies ΔB
tail
state after Track(keys) + rebuild.
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
keys
SetKey
,
trackSet
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
X
:=
exc
.
Raiseif
...
...
@@ -1336,7 +1336,7 @@ func ΔBTest(xtest interface{}) ΔBTestEntry {
return
test
}
//
ΔB
Commit represent test commit changing a tree.
//
tTree
Commit represent test commit changing a tree.
type
tTreeCommit
struct
{
tree
string
// the tree in toplogy-encoding
prev
*
tTreeCommit
// previous commit
...
...
@@ -1681,9 +1681,11 @@ func TestΔBTail(t *testing.T) {
"T/B0:a"
,
// δtkeycov grows due to change in parent tree only
"T3/B1:a-B8:c"
,
"T7/B1:a-B8:c"
,
// ----//----
"T3/B1:a,2:b-B8:c,9:d"
,
"T7/B1:a,2:b-B8:c,9:d"
,
// ----//---- depth=2
"T3/T-T/B1:a,2:b-B8:c,9:d"
,
"T7/T-T/B1:a,2:b-B8:c,9:d"
,
...
...
@@ -1775,8 +1777,8 @@ func TestΔBTailAllStructs(t *testing.T) {
X
:=
exc
.
Raiseif
// considerations:
// -
depth↑
better for testing (more tricky topologies)
// -
n
split↑ not so better for testing (leave s=1, max s=2)
// -
maxdepth↑
better for testing (more tricky topologies)
// -
max
split↑ not so better for testing (leave s=1, max s=2)
// - |kmin - kmax| affects N(variants) significantly
// -> keep key range small (dumb increase does not help testing)
// - N(keys) affects N(variants) significantly
...
...
@@ -2006,39 +2008,6 @@ func allTestKeys(vt ...*tTreeCommit) SetKey {
return
allKeys
}
/*
// easies debugging / makes error output stable from run to run.
func (ks SetKey) SortedElements() []Key {
keyv := ks.Elements()
sort.Slice(keyv, func(i, j int) bool {
return keyv[i] < keyv[j]
})
return keyv
}
func (ks SetKey) String() string {
strv := []string{}
for _, k := range ks.SortedElements() {
strv = append(strv, fmt.Sprintf("%d", k))
}
return "{" + strings.Join(strv, " ") + "}"
}
func (os SetOid) SortedElements() []zodb.Oid {
oidv := os.Elements()
sort.Slice(oidv, func(i, j int) bool {
return oidv[i] < oidv[j]
})
return oidv
}
func (os SetOid) String() string {
strv := []string{}
for _, oid := range os.SortedElements() {
strv = append(strv, fmt.Sprintf("%s", oid))
}
return "{" + strings.Join(strv, " ") + "}"
}
*/
func
sortedKeys
(
kv
map
[
Key
]
Δstring
)
[]
Key
{
keyv
:=
[]
Key
{}
for
k
:=
range
kv
{
...
...
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