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
822b420d
Commit
822b420d
authored
Jun 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9d7e53ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+7
-5
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+26
-1
No files found.
wcfs/testprog/treegen.py
View file @
822b420d
...
@@ -74,7 +74,7 @@ XXX
...
@@ -74,7 +74,7 @@ XXX
from
__future__
import
print_function
,
absolute_import
from
__future__
import
print_function
,
absolute_import
import
sys
import
os
,
sys
from
golang
import
func
,
defer
,
panic
from
golang
import
func
,
defer
,
panic
from
golang
import
time
from
golang
import
time
from
ZODB
import
DB
from
ZODB
import
DB
...
@@ -118,7 +118,7 @@ class ZCtx(object):
...
@@ -118,7 +118,7 @@ class ZCtx(object):
valdict
=
zctx
.
root
.
get
(
'treegen/values'
,
None
)
valdict
=
zctx
.
root
.
get
(
'treegen/values'
,
None
)
if
valdict
is
None
:
if
valdict
is
None
:
valdict
=
zctx
.
root
[
'treegen/values'
]
=
PersistentMapping
()
valdict
=
zctx
.
root
[
'treegen/values'
]
=
PersistentMapping
()
valv
=
b'abcdefgh
i
'
valv
=
b'abcdefgh'
for
v
in
valv
:
for
v
in
valv
:
zblk
=
valdict
.
get
(
v
,
None
)
zblk
=
valdict
.
get
(
v
,
None
)
if
zblk
is
not
None
and
zblk
.
loadblkdata
()
==
v
:
if
zblk
is
not
None
and
zblk
.
loadblkdata
()
==
v
:
...
@@ -305,7 +305,8 @@ def AllStructs(kv1txt, kv2txt, maxdepth, maxsplit, n, seed=None):
...
@@ -305,7 +305,8 @@ def AllStructs(kv1txt, kv2txt, maxdepth, maxsplit, n, seed=None):
# seed
# seed
if
seed
is
None
:
if
seed
is
None
:
seed
=
int
(
time
.
now
())
seed
=
time
.
now
()
seed
=
int
(
seed
)
random
.
seed
(
seed
)
random
.
seed
(
seed
)
print
(
"# maxdepth=%d maxsplit=%d n=%d seed=%d"
%
(
maxdepth
,
maxsplit
,
n
,
seed
))
print
(
"# maxdepth=%d maxsplit=%d n=%d seed=%d"
%
(
maxdepth
,
maxsplit
,
n
,
seed
))
...
@@ -451,9 +452,10 @@ def cmd_allstructs(argv):
...
@@ -451,9 +452,10 @@ def cmd_allstructs(argv):
maxdepth
=
int
(
argv
[
0
])
maxdepth
=
int
(
argv
[
0
])
maxsplit
=
int
(
argv
[
1
])
maxsplit
=
int
(
argv
[
1
])
n
=
int
(
argv
[
2
])
n
=
int
(
argv
[
2
])
# XXX -> nsample?
kv1
,
kv2
=
argv
[
3
:]
kv1
,
kv2
=
argv
[
3
:]
AllStructs
(
kv1
,
kv2
,
maxdepth
,
maxsplit
,
n
)
seed
=
os
.
environ
.
get
(
"treegen_SEED"
)
AllStructs
(
kv1
,
kv2
,
maxdepth
,
maxsplit
,
n
,
seed
)
@
func
@
func
def
cmd_trees
(
argv
):
def
cmd_trees
(
argv
):
...
...
wcfs/δbtail_test.go
View file @
822b420d
...
@@ -27,13 +27,16 @@ import (
...
@@ -27,13 +27,16 @@ import (
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
"math/rand"
"os"
"os"
"os/exec"
"os/exec"
"reflect"
"reflect"
"regexp"
"regexp"
"sort"
"sort"
"strconv"
"strings"
"strings"
"testing"
"testing"
"time"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
...
@@ -453,11 +456,33 @@ func TestΔBTreeAllStructs(t *testing.T) {
...
@@ -453,11 +456,33 @@ func TestΔBTreeAllStructs(t *testing.T) {
// XXX explain that py program startup is very slow due to
// XXX explain that py program startup is very slow due to
// pkg_resources (+ link) -> we use server + request/response.
// pkg_resources (+ link) -> we use server + request/response.
seed
:=
time
.
Now
()
.
UnixNano
()
seeds
:=
os
.
Getenv
(
"DBTail_SEED"
)
if
seeds
!=
""
{
var
err
error
seed
,
err
=
strconv
.
ParseInt
(
seeds
,
10
,
64
)
if
err
!=
nil
{
t
.
Fatalf
(
"invalid $DBTail_SEED=%s: %s"
,
seeds
,
err
)
}
}
t
.
Logf
(
"# seed=%d"
,
seed
)
rng
:=
rand
.
New
(
rand
.
NewSource
(
seed
))
maxdepth
:=
2
// XXX -> 3?
maxdepth
:=
2
// XXX -> 3?
maxsplit
:=
1
// XXX -> 2?
maxsplit
:=
1
// XXX -> 2?
n
:=
10
// XXX -> more?
/*
kv1 = {}
for keys := range IntSets(5) { // XXX !short -> ↑
kv2 = {k -> v=random.choice('abcdefgh'); for k in keys }
}
*/
_
=
maxdepth
;
_
=
maxsplit
_
=
maxdepth
;
_
=
maxsplit
;
_
=
n
;
_
=
rng
}
}
...
...
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