From: Dmitry Vyukov Date: Fri, 26 Feb 2016 15:14:31 +0000 (+0100) Subject: sync/atomic: reduce test in short mode X-Git-Tag: go1.7beta1~1695 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e1035c5e878c0aae938f4ee933055d4333c5cbe5;p=gostls13.git sync/atomic: reduce test in short mode In normal mode the test runs for 9+ seconds on my machine (48 cores). But the real problem is race mode, in race mode it hits 10m test timeout. Reduce test size in short mode. Now it runs for 100ms without race. Change-Id: I9493a0e84f630b930af8f958e2920025df37c268 Reviewed-on: https://go-review.googlesource.com/19956 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/sync/atomic/value_test.go b/src/sync/atomic/value_test.go index 382dc6854d..fd90451dd8 100644 --- a/src/sync/atomic/value_test.go +++ b/src/sync/atomic/value_test.go @@ -86,6 +86,11 @@ func TestValueConcurrent(t *testing.T) { {complex(0, 0), complex(1, 2), complex(3, 4), complex(5, 6)}, } p := 4 * runtime.GOMAXPROCS(0) + N := int(1e5) + if testing.Short() { + p /= 2 + N = 1e3 + } for _, test := range tests { var v Value done := make(chan bool) @@ -93,7 +98,7 @@ func TestValueConcurrent(t *testing.T) { go func() { r := rand.New(rand.NewSource(rand.Int63())) loop: - for j := 0; j < 1e5; j++ { + for j := 0; j < N; j++ { x := test[r.Intn(len(test))] v.Store(x) x = v.Load()