diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-11-22 12:03:55 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-11-23 09:09:39 +0100 |
| commit | caddc6cbcef9933a4539a06714df006e0c5ac7b2 (patch) | |
| tree | a1c058c702d31527eb9a183f8115f73d6945776b /pkg/ifuzz | |
| parent | 75740b3f90c81d4c226b0e30eec947df4fbd6832 (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/ifuzz')
| -rw-r--r-- | pkg/ifuzz/ifuzz_test.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/pkg/ifuzz/ifuzz_test.go b/pkg/ifuzz/ifuzz_test.go index eee8afe00..11f57216b 100644 --- a/pkg/ifuzz/ifuzz_test.go +++ b/pkg/ifuzz/ifuzz_test.go @@ -6,11 +6,10 @@ package ifuzz import ( "encoding/hex" "math/rand" - "os" "testing" - "time" "github.com/google/syzkaller/pkg/ifuzz/iset" + "github.com/google/syzkaller/pkg/testutil" ) var allArches = []string{ArchX86, ArchPowerPC} @@ -53,12 +52,7 @@ func testDecode(t *testing.T, arch string) { if _, err := insnset.DecodeExt(0, nil); err == nil { xedEnabled = true } - seed := time.Now().UnixNano() - if os.Getenv("CI") != "" { - seed = 0 // required for deterministic coverage reports - } - t.Logf("seed=%v", seed) - r := rand.New(rand.NewSource(seed)) + r := rand.New(testutil.RandSource(t)) for repeat := 0; repeat < 10; repeat++ { for mode := iset.Mode(0); mode < iset.ModeLast; mode++ { |
