diff --git a/chunker/buzhash_norace_test.go b/chunker/buzhash_norace_test.go deleted file mode 100644 index 50dc0e5ce..000000000 --- a/chunker/buzhash_norace_test.go +++ /dev/null @@ -1,14 +0,0 @@ -//go: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) - } -} diff --git a/chunker/buzhash_test.go b/chunker/buzhash_test.go index fe6de4434..2eaf5ae32 100644 --- a/chunker/buzhash_test.go +++ b/chunker/buzhash_test.go @@ -9,6 +9,8 @@ import ( ) func testBuzhashChunking(t *testing.T, buf []byte) (chunkCount int) { + t.Parallel() + n, err := util.NewTimeSeededRand().Read(buf) if n < len(buf) { t.Fatalf("expected %d bytes, got %d", len(buf), n) @@ -89,3 +91,13 @@ func TestBuzhashBitsHashBias(t *testing.T) { } } } + +func FuzzBuzhashChunking(f *testing.F) { + f.Add(make([]byte, 1024*1024*16)) + f.Fuzz(func(t *testing.T, b []byte) { + if len(b) < buzMin { + return + } + testBuzhashChunking(t, b) + }) +} diff --git a/chunker/parse_test.go b/chunker/parse_test.go index 2a33d64de..6809476e9 100644 --- a/chunker/parse_test.go +++ b/chunker/parse_test.go @@ -11,6 +11,8 @@ const ( ) func TestParseRabin(t *testing.T) { + t.Parallel() + r := bytes.NewReader(randBuf(t, 1000)) _, err := FromString(r, "rabin-18-25-32") @@ -55,6 +57,8 @@ func TestParseRabin(t *testing.T) { } func TestParseSize(t *testing.T) { + t.Parallel() + r := bytes.NewReader(randBuf(t, 1000)) _, err := FromString(r, "size-0") diff --git a/chunker/rabin_test.go b/chunker/rabin_test.go index 79699e324..31f3464ee 100644 --- a/chunker/rabin_test.go +++ b/chunker/rabin_test.go @@ -11,6 +11,8 @@ import ( ) func TestRabinChunking(t *testing.T) { + t.Parallel() + data := make([]byte, 1024*1024*16) n, err := util.NewTimeSeededRand().Read(data) if n < len(data) { @@ -67,6 +69,8 @@ func chunkData(t *testing.T, newC newSplitter, data []byte) map[string]blocks.Bl } func testReuse(t *testing.T, cr newSplitter) { + t.Parallel() + data := make([]byte, 1024*1024*16) n, err := util.NewTimeSeededRand().Read(data) if n < len(data) { diff --git a/chunker/splitting_test.go b/chunker/splitting_test.go index 4a9f7f332..c6712446a 100644 --- a/chunker/splitting_test.go +++ b/chunker/splitting_test.go @@ -23,6 +23,8 @@ func copyBuf(buf []byte) []byte { } func TestSizeSplitterOverAllocate(t *testing.T) { + t.Parallel() + max := 1000 r := bytes.NewReader(randBuf(t, max)) chunksize := int64(1024 * 256) @@ -40,6 +42,7 @@ func TestSizeSplitterIsDeterministic(t *testing.T) { if testing.Short() { t.SkipNow() } + t.Parallel() test := func() { bufR := randBuf(t, 10000000) // crank this up to satisfy yourself. @@ -75,6 +78,7 @@ func TestSizeSplitterFillsChunks(t *testing.T) { if testing.Short() { t.SkipNow() } + t.Parallel() max := 10000000 b := randBuf(t, max)