aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/repro
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-11-22 12:03:55 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-11-23 09:09:39 +0100
commitcaddc6cbcef9933a4539a06714df006e0c5ac7b2 (patch)
treea1c058c702d31527eb9a183f8115f73d6945776b /pkg/repro
parent75740b3f90c81d4c226b0e30eec947df4fbd6832 (diff)
pkg/testutil: add RandSource helper
The code to send rand source is dublicated in several packages. Move it to testutil package.
Diffstat (limited to 'pkg/repro')
-rw-r--r--pkg/repro/repro_test.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/repro/repro_test.go b/pkg/repro/repro_test.go
index d02ea6d67..486dc963b 100644
--- a/pkg/repro/repro_test.go
+++ b/pkg/repro/repro_test.go
@@ -5,11 +5,10 @@ package repro
import (
"math/rand"
- "os"
"testing"
- "time"
"github.com/google/syzkaller/pkg/csource"
+ "github.com/google/syzkaller/pkg/testutil"
"github.com/google/syzkaller/prog"
"github.com/google/syzkaller/sys/targets"
)
@@ -19,13 +18,7 @@ func initTest(t *testing.T) (*rand.Rand, int) {
if testing.Short() {
iters = 100
}
- seed := time.Now().UnixNano()
- if os.Getenv("CI") != "" {
- seed = 0 // required for deterministic coverage reports
- }
- rs := rand.NewSource(seed)
- t.Logf("seed=%v", seed)
- return rand.New(rs), iters
+ return rand.New(testutil.RandSource(t)), iters
}
func TestBisect(t *testing.T) {