mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-14 00:13:23 +00:00
prog, pkg/{csource,ifuzz,ipc,repro}: make tests deterministic on travis
Don't use random seed on travis as it produces flaky coverage reports, and probably generally better for CI setting.
This commit is contained in:
parent
f0491811f9
commit
06a2b89fc3
@ -61,6 +61,9 @@ func TestGenerate(t *testing.T) {
|
||||
|
||||
func testTarget(t *testing.T, target *prog.Target, full bool) {
|
||||
seed := int64(time.Now().UnixNano())
|
||||
if os.Getenv("TRAVIS") != "" {
|
||||
seed = 0 // required for deterministic coverage reports
|
||||
}
|
||||
rs := rand.NewSource(seed)
|
||||
t.Logf("seed=%v", seed)
|
||||
p := target.Generate(rs, 10, nil)
|
||||
|
@ -6,6 +6,7 @@ package ifuzz_test
|
||||
import (
|
||||
"encoding/hex"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -36,6 +37,9 @@ func TestMode(t *testing.T) {
|
||||
|
||||
func TestDecode(t *testing.T) {
|
||||
seed := int64(time.Now().UnixNano())
|
||||
if os.Getenv("TRAVIS") != "" {
|
||||
seed = 0 // required for deterministic coverage reports
|
||||
}
|
||||
t.Logf("seed=%v", seed)
|
||||
r := rand.New(rand.NewSource(seed))
|
||||
|
||||
|
@ -38,6 +38,9 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, EnvFlags) {
|
||||
iters = 10
|
||||
}
|
||||
seed := int64(time.Now().UnixNano())
|
||||
if os.Getenv("TRAVIS") != "" {
|
||||
seed = 0 // required for deterministic coverage reports
|
||||
}
|
||||
rs := rand.NewSource(seed)
|
||||
t.Logf("seed=%v", seed)
|
||||
target, err := prog.GetTarget(runtime.GOOS, runtime.GOARCH)
|
||||
|
@ -5,6 +5,7 @@ package repro
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -18,6 +19,9 @@ func initTest(t *testing.T) (*rand.Rand, int) {
|
||||
iters = 100
|
||||
}
|
||||
seed := int64(time.Now().UnixNano())
|
||||
if os.Getenv("TRAVIS") != "" {
|
||||
seed = 0 // required for deterministic coverage reports
|
||||
}
|
||||
rs := rand.NewSource(seed)
|
||||
t.Logf("seed=%v", seed)
|
||||
return rand.New(rs), iters
|
||||
|
@ -6,6 +6,7 @@ package prog
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@ -32,6 +33,9 @@ func initTargetTest(t *testing.T, os, arch string) *Target {
|
||||
|
||||
func randSource(t *testing.T) rand.Source {
|
||||
seed := int64(time.Now().UnixNano())
|
||||
if os.Getenv("TRAVIS") != "" {
|
||||
seed = 0 // required for deterministic coverage reports
|
||||
}
|
||||
t.Logf("seed=%v", seed)
|
||||
return rand.NewSource(seed)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"math/rand"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGeneration(t *testing.T) {
|
||||
@ -144,9 +143,7 @@ func TestCrossTarget(t *testing.T) {
|
||||
}
|
||||
|
||||
func testCrossTarget(t *testing.T, target *Target, crossTargets []*Target) {
|
||||
seed := int64(time.Now().UnixNano())
|
||||
t.Logf("seed=%v", seed)
|
||||
rs := rand.NewSource(seed)
|
||||
rs := randSource(t)
|
||||
iters := 100
|
||||
if testing.Short() {
|
||||
iters /= 10
|
||||
|
Loading…
x
Reference in New Issue
Block a user