aboutsummaryrefslogtreecommitdiff
path: root/src/sync/atomic/value_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync/atomic/value_test.go')
-rw-r--r--src/sync/atomic/value_test.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sync/atomic/value_test.go b/src/sync/atomic/value_test.go
index fd69ba30dc..f289766340 100644
--- a/src/sync/atomic/value_test.go
+++ b/src/sync/atomic/value_test.go
@@ -91,10 +91,11 @@ func TestValueConcurrent(t *testing.T) {
}
for _, test := range tests {
var v Value
- done := make(chan bool)
+ done := make(chan bool, p)
for i := 0; i < p; i++ {
go func() {
r := rand.New(rand.NewSource(rand.Int63()))
+ expected := true
loop:
for j := 0; j < N; j++ {
x := test[r.Intn(len(test))]
@@ -106,9 +107,10 @@ func TestValueConcurrent(t *testing.T) {
}
}
t.Logf("loaded unexpected value %+v, want %+v", x, test)
- done <- false
+ expected = false
+ break
}
- done <- true
+ done <- expected
}()
}
for i := 0; i < p; i++ {