Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-chunker
Commits
cbf45fd2
Commit
cbf45fd2
authored
Mar 26, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: avoid fuzzing while the race detector is enabled
It's too slow.
parent
03118146
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
33 deletions
+47
-33
buzhash_norace_test.go
buzhash_norace_test.go
+14
-0
buzhash_test.go
buzhash_test.go
+33
-33
No files found.
buzhash_norace_test.go
0 → 100644
View file @
cbf45fd2
//+build !race
package
chunk
import
(
"testing"
)
func
TestFuzzBuzhashChunking
(
t
*
testing
.
T
)
{
buf
:=
make
([]
byte
,
1024
*
1024
*
16
)
for
i
:=
0
;
i
<
100
;
i
++
{
testBuzhashChunking
(
t
,
buf
)
}
}
buzhash_test.go
View file @
cbf45fd2
...
...
@@ -8,16 +8,10 @@ import (
util
"github.com/ipfs/go-ipfs-util"
)
func
TestBuzhashChunking
(
t
*
testing
.
T
)
{
data
:=
make
([]
byte
,
1024
*
1024
*
16
)
chunkCount
:=
0
rounds
:=
100
func
testBuzhashChunking
(
t
*
testing
.
T
,
buf
[]
byte
)
(
chunkCount
int
)
{
util
.
NewTimeSeededRand
()
.
Read
(
buf
)
for
i
:=
0
;
i
<
rounds
;
i
++
{
util
.
NewTimeSeededRand
()
.
Read
(
data
)
r
:=
NewBuzhash
(
bytes
.
NewReader
(
data
))
r
:=
NewBuzhash
(
bytes
.
NewReader
(
buf
))
var
chunks
[][]
byte
...
...
@@ -47,11 +41,17 @@ func TestBuzhashChunking(t *testing.T) {
}
unchunked
:=
bytes
.
Join
(
chunks
,
nil
)
if
!
bytes
.
Equal
(
unchunked
,
data
)
{
if
!
bytes
.
Equal
(
unchunked
,
buf
)
{
t
.
Fatal
(
"data was chunked incorrectly"
)
}
}
t
.
Logf
(
"average block size: %d
\n
"
,
len
(
data
)
*
rounds
/
chunkCount
)
return
chunkCount
}
func
TestBuzhashChunking
(
t
*
testing
.
T
)
{
buf
:=
make
([]
byte
,
1024
*
1024
*
16
)
count
:=
testBuzhashChunking
(
t
,
buf
)
t
.
Logf
(
"average block size: %d
\n
"
,
len
(
buf
)
/
count
)
}
func
TestBuzhashChunkReuse
(
t
*
testing
.
T
)
{
...
...
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