diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-02-26 16:14:31 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-02-26 16:41:12 +0000 |
| commit | e1035c5e878c0aae938f4ee933055d4333c5cbe5 (patch) | |
| tree | d2fe508f07d37e06400fa289fff392a0c5f69458 /src/sync | |
| parent | 9f26170a02327c7e03dff148faf278866a79f8b4 (diff) | |
| download | go-e1035c5e878c0aae938f4ee933055d4333c5cbe5.tar.xz | |
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/sync')
| -rw-r--r-- | src/sync/atomic/value_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
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() |
