From 56250633ec0a1d1a77a9f35dd6fe7175142d43d9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 3 Jun 2022 09:18:26 +0200 Subject: 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. --- prog/export_test.go | 4 ++++ 1 file changed, 4 insertions(+) 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 } -- cgit mrf-deployment