Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
b20eddfe
Commit
b20eddfe
authored
Mar 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3c3d7063
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
t/neo/storage/fs1/cmd/fstail/fstail.go
t/neo/storage/fs1/cmd/fstail/fstail.go
+6
-0
t/neo/storage/fs1/cmd/fstail/fstail_test.go
t/neo/storage/fs1/cmd/fstail/fstail_test.go
+40
-0
t/neo/zodb/cmd/zodbdump/zodbdump_test.go
t/neo/zodb/cmd/zodbdump/zodbdump_test.go
+3
-0
No files found.
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
b20eddfe
...
@@ -46,6 +46,12 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) {
...
@@ -46,6 +46,12 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
defer
func
()
{
err2
:=
f
.
Close
()
if
err
==
nil
{
err
=
err2
}
}()
// get file size as topPos
// get file size as topPos
fi
,
err
:=
f
.
Stat
()
fi
,
err
:=
f
.
Stat
()
...
...
t/neo/storage/fs1/cmd/fstail/fstail_test.go
View file @
b20eddfe
...
@@ -3,3 +3,43 @@
...
@@ -3,3 +3,43 @@
package
main
package
main
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../../testdata/1.fs >testdata/1.fsdump.ok"
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../../testdata/1.fs >testdata/1.fsdump.ok"
import
(
"bytes"
"io/ioutil"
"testing"
"github.com/sergi/go-diff/diffmatchpatch"
)
// XXX -> xtesting ?
func
loadFile
(
t
*
testing
.
T
,
path
string
)
string
{
data
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
return
string
(
data
)
}
// XXX -> xtesting ?
// XXX dup in zodbdump_test.go
func
diff
(
a
,
b
string
)
string
{
dmp
:=
diffmatchpatch
.
New
()
diffv
:=
dmp
.
DiffMain
(
a
,
b
,
/*checklines=*/
false
)
return
dmp
.
DiffPrettyText
(
diffv
)
}
func
TestFsDump
(
t
*
testing
.
T
)
{
buf
:=
bytes
.
Buffer
{}
err
:=
fsDump
(
&
buf
,
"../../testdata/1.fs"
,
1000000
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
dumpOk
:=
loadFile
(
t
,
"testdata/1.fsdump.ok"
)
if
dumpOk
!=
buf
.
String
()
{
t
.
Errorf
(
"dump different:
\n
%v"
,
diff
(
dumpOk
,
buf
.
String
()))
}
}
t/neo/zodb/cmd/zodbdump/zodbdump_test.go
View file @
b20eddfe
...
@@ -18,6 +18,8 @@ import (
...
@@ -18,6 +18,8 @@ import (
)
)
// diff computes difference for two strings a and b
// diff computes difference for two strings a and b
// XXX -> xtesting ?
// XXX dup in fstail_test.go
func
diff
(
a
,
b
string
)
string
{
func
diff
(
a
,
b
string
)
string
{
dmp
:=
diffmatchpatch
.
New
()
dmp
:=
diffmatchpatch
.
New
()
diffv
:=
dmp
.
DiffMain
(
a
,
b
,
/*checklines=*/
false
)
diffv
:=
dmp
.
DiffMain
(
a
,
b
,
/*checklines=*/
false
)
...
@@ -42,6 +44,7 @@ func loadZdumpPy(t *testing.T, path string) string {
...
@@ -42,6 +44,7 @@ func loadZdumpPy(t *testing.T, path string) string {
r0c
:=
regexp
.
MustCompile
(
`\\x0c`
)
r0c
:=
regexp
.
MustCompile
(
`\\x0c`
)
dump
=
r0b
.
ReplaceAllLiteral
(
dump
,
[]
byte
(
`\v`
))
dump
=
r0b
.
ReplaceAllLiteral
(
dump
,
[]
byte
(
`\v`
))
dump
=
r0c
.
ReplaceAllLiteral
(
dump
,
[]
byte
(
`\f`
))
dump
=
r0c
.
ReplaceAllLiteral
(
dump
,
[]
byte
(
`\f`
))
return
string
(
dump
)
return
string
(
dump
)
}
}
...
...
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