Commit e1035c5e authored by Dmitry Vyukov's avatar Dmitry Vyukov

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/19956Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 9f26170a
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment