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
02db2a48
Commit
02db2a48
authored
May 29, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
aefd787f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+4
-2
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+31
-4
No files found.
wcfs/testprog/treegen.py
View file @
02db2a48
...
...
@@ -181,8 +181,10 @@ def Trees(zstor, r):
xbtree
.
Restructure
(
ztree
,
tree
)
tid
=
commit
(
"treegen/trees: %s"
%
treetxt
)
# XXX print more details
print
(
"txn %s -> tree(%s) %s"
%
(
ashex
(
tid
),
ashex
(
ztree
.
_p_oid
),
treetxt
))
# XXX print more details?
# XXX print just tid (as `zodb commit` does) ?
#print("txn %s -> tree(%s) %s" % (ashex(tid), ashex(ztree._p_oid), treetxt))
print
(
"%s"
%
ashex
(
tid
))
# AllStructs generates subset of all possible tree changes in
...
...
wcfs/δbtail_test.go
View file @
02db2a48
...
...
@@ -20,9 +20,12 @@
package
main
import
(
"bufio"
"fmt"
"io"
"os"
"os/exec"
"strings"
"testing"
"lab.nexedi.com/kirr/go123/xerr"
...
...
@@ -37,7 +40,8 @@ type TreeGen struct {
zurl
string
pysrv
*
exec
.
Cmd
// spawned `treegen trees`
pyin
*
io
.
PipeWriter
// input to pysrv
pyout
*
io
.
PipeReader
// output from pysrv
pyoutRaw
*
io
.
PipeReader
// output from pysrv
pyout
*
bufio
.
Reader
// buffered ^^^
treeRoot
zodb
.
Oid
// oid of the tree treegen works on
}
...
...
@@ -47,8 +51,9 @@ func StartTreeGen(zurl string) (_ *TreeGen, err error) {
tg
:=
&
TreeGen
{
zurl
:
zurl
}
tg
.
pysrv
=
exec
.
Command
(
"./testprog/treegen.py"
,
"trees"
)
tg
.
pysrv
.
Stdin
,
tg
.
pyin
=
io
.
Pipe
()
tg
.
pyout
,
tg
.
pysrv
.
Stdout
=
io
.
Pipe
()
tg
.
pysrv
.
Stdin
,
tg
.
pyin
=
io
.
Pipe
()
tg
.
pyoutRaw
,
tg
.
pysrv
.
Stdout
=
io
.
Pipe
()
tg
.
pyout
=
bufio
.
NewReader
(
tg
.
pyout
)
tg
.
pysrv
.
Stderr
=
os
.
Stderr
// no redirection
err
=
tg
.
pysrv
.
Start
()
...
...
@@ -66,11 +71,33 @@ func (tg *TreeGen) Close() (err error) {
defer
xerr
.
Contextf
(
&
err
,
"treegen %s: close"
,
tg
.
zurl
)
err1
:=
tg
.
pyin
.
Close
()
err2
:=
tg
.
pyout
.
Close
()
err2
:=
tg
.
pyout
Raw
.
Close
()
err3
:=
tg
.
pysrv
.
Wait
()
return
xerr
.
Merge
(
err1
,
err2
,
err3
)
}
// Commit creates new commit with underlying tree changed to tree topology.
func
(
tg
*
TreeGen
)
Commit
(
tree
string
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %s: commit %s"
,
tg
.
zurl
,
tree
)
_
,
err
=
io
.
WriteString
(
tg
.
pyin
,
tree
+
"
\n
"
)
if
err
!=
nil
{
return
zodb
.
InvalidTid
,
err
}
reply
,
err
:=
tg
.
pyout
.
ReadString
(
'\n'
)
if
err
!=
nil
{
return
zodb
.
InvalidTid
,
err
}
reply
=
strings
.
TrimSuffix
(
reply
,
"
\n
"
)
tid
,
err
:=
zodb
.
ParseTid
(
reply
)
if
err
!=
nil
{
return
zodb
.
InvalidTid
,
fmt
.
Errorf
(
"invalid reply: %s"
,
err
)
}
return
tid
,
nil
}
// XXX
func
XXX
(
t
*
testing
.
T
,
tree1
,
tree2
string
)
{
// XXX commit tree1
...
...
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