aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-06-03 09:18:26 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-06-03 17:26:50 +0200
commit56250633ec0a1d1a77a9f35dd6fe7175142d43d9 (patch)
tree37001a6ede86bae6e2a0db92568bff446e711e48
parenteee80d3cd37ea7ebd6aab85c117564a4bae5bc4e (diff)
prog: allow to use fixed test seed w/o rebuilding tests
Currently reproducing crashed with a particular seed requires changing sources and rebuilding the test. Make it possible to provide seed via env var.
-rw-r--r--prog/export_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/prog/export_test.go b/prog/export_test.go
index 415b03047..4a116dc49 100644
--- a/prog/export_test.go
+++ b/prog/export_test.go
@@ -7,6 +7,7 @@ import (
"fmt"
"math/rand"
"os"
+ "strconv"
"testing"
"time"
@@ -27,6 +28,9 @@ var (
func randSource(t *testing.T) rand.Source {
seed := time.Now().UnixNano()
+ if fixed := os.Getenv("SYZ_SEED"); fixed != "" {
+ seed, _ = strconv.ParseInt(fixed, 0, 64)
+ }
if os.Getenv("CI") != "" {
seed = 0 // required for deterministic coverage reports
}