aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
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/ipc
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/ipc')
-rw-r--r--pkg/ipc/ipc_test.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index 3456852c5..0734fbe6e 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -16,6 +16,7 @@ import (
. "github.com/google/syzkaller/pkg/ipc"
"github.com/google/syzkaller/pkg/ipc/ipcconfig"
"github.com/google/syzkaller/pkg/osutil"
+ "github.com/google/syzkaller/pkg/testutil"
"github.com/google/syzkaller/prog"
_ "github.com/google/syzkaller/sys"
"github.com/google/syzkaller/sys/targets"
@@ -36,12 +37,6 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool, targets
if testing.Short() {
iters = 10
}
- seed := time.Now().UnixNano()
- if os.Getenv("CI") != "" {
- seed = 0 // required for deterministic coverage reports
- }
- rs := rand.NewSource(seed)
- t.Logf("seed=%v", seed)
target, err := prog.GetTarget(runtime.GOOS, runtime.GOARCH)
if err != nil {
t.Fatal(err)
@@ -50,6 +45,7 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool, targets
if err != nil {
t.Fatal(err)
}
+ rs := testutil.RandSource(t)
return target, rs, iters, cfg.UseShmem, cfg.UseForkServer, cfg.Timeouts
}