Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
bcea2cb6
Commit
bcea2cb6
authored
Mar 17, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fc1e058b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
7 deletions
+42
-7
go/zodb/storage/fs1/fs1tools/dump_test.go
go/zodb/storage/fs1/fs1tools/dump_test.go
+16
-7
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdump.ok
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdump.ok
+3
-0
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdumpv.ok
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdumpv.ok
+20
-0
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fstail.ok
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fstail.ok
+3
-0
No files found.
go/zodb/storage/fs1/fs1tools/dump_test.go
View file @
bcea2cb6
// Copyright (C) 2017 Nexedi SA and Contributors.
// Copyright (C) 2017
-2021
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Kirill Smelkov <kirr@nexedi.com>
//
//
// This program is free software: you can Use, Study, Modify and Redistribute
// This program is free software: you can Use, Study, Modify and Redistribute
...
@@ -31,6 +31,10 @@ package fs1tools
...
@@ -31,6 +31,10 @@ package fs1tools
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/empty.fs >testdata/empty.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/empty.fs >testdata/empty.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/empty.fs >testdata/empty.fsdumpv.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/empty.fs >testdata/empty.fsdumpv.ok"
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../testdata/whiteout.fs >testdata/whiteout.fstail.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/whiteout.fs >testdata/whiteout.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/whiteout.fs >testdata/whiteout.fsdumpv.ok"
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
...
@@ -50,10 +54,11 @@ func loadFile(t *testing.T, path string) string {
...
@@ -50,10 +54,11 @@ func loadFile(t *testing.T, path string) string {
return
string
(
data
)
return
string
(
data
)
}
}
func
testDump
(
t
*
testing
.
T
,
dir
fs1
.
IterDir
,
d
Dumper
)
{
func
testDump
(
t
*
testing
.
T
,
dir
fs1
.
IterDir
,
newd
func
()
Dumper
)
{
testv
:=
[]
string
{
"1"
,
"empty"
}
testv
:=
[]
string
{
"1"
,
"empty"
,
"whiteout"
}
for
_
,
tt
:=
range
testv
{
for
_
,
tt
:=
range
testv
{
t
.
Run
(
"db="
+
tt
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"db="
+
tt
,
func
(
t
*
testing
.
T
)
{
d
:=
newd
()
buf
:=
bytes
.
Buffer
{}
buf
:=
bytes
.
Buffer
{}
err
:=
Dump
(
&
buf
,
fmt
.
Sprintf
(
"../testdata/%s.fs"
,
tt
),
dir
,
d
)
err
:=
Dump
(
&
buf
,
fmt
.
Sprintf
(
"../testdata/%s.fs"
,
tt
),
dir
,
d
)
...
@@ -70,9 +75,13 @@ func testDump(t *testing.T, dir fs1.IterDir, d Dumper) {
...
@@ -70,9 +75,13 @@ func testDump(t *testing.T, dir fs1.IterDir, d Dumper) {
}
}
}
}
func
TestFsDump
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterForward
,
&
DumperFsDump
{})
}
func
newFsDump
()
Dumper
{
return
&
DumperFsDump
{}
}
func
TestFsDumpv
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterForward
,
&
DumperFsDumpVerbose
{})
}
func
newFsDumpv
()
Dumper
{
return
&
DumperFsDumpVerbose
{}
}
func
TestFsTail
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterBackward
,
&
DumperFsTail
{
Ntxn
:
1000000
})
}
func
newFsTail
()
Dumper
{
return
&
DumperFsTail
{
Ntxn
:
1000000
}
}
func
TestFsDump
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterForward
,
newFsDump
)
}
func
TestFsDumpv
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterForward
,
newFsDumpv
)
}
func
TestFsTail
(
t
*
testing
.
T
)
{
testDump
(
t
,
fs1
.
IterBackward
,
newFsTail
)
}
func
BenchmarkTail
(
b
*
testing
.
B
)
{
func
BenchmarkTail
(
b
*
testing
.
B
)
{
// FIXME small testdata/1.fs is not representative for benchmarking
// FIXME small testdata/1.fs is not representative for benchmarking
...
...
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdump.ok
0 → 100644
View file @
bcea2cb6
Trans #00000 tid=0000000000000017 time=1900-01-01 00:00:00.000000 offset=27
status=' ' user='' description=''
data #00000 oid=0000000000000001 class=undo or abort of object creation
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fsdumpv.ok
0 → 100644
View file @
bcea2cb6
************************************************************
file identifier: 'FS21'
============================================================
offset: 4
end pos: 77
transaction id: 0000000000000017
trec len: 73
status: ' '
user: ''
description: ''
len(extra): 0
------------------------------------------------------------
offset: 27
oid: 0000000000000001
revid: 0000000000000017
previous record offset: 0
transaction offset: 4
len(data): 0
backpointer: 0
redundant trec len: 73
go/zodb/storage/fs1/fs1tools/testdata/whiteout.fstail.ok
0 → 100644
View file @
bcea2cb6
1900-01-01 00:00:00.000000: hash=e3e0ff6c686f2fa02266e744f6629d592d432061
user='' description='' length=73 offset=4 (+23)
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