]> Cypherpunks repositories - gostls13.git/commitdiff
sync: don't run known-racy tests under the race detector
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 26 Jun 2015 21:52:52 +0000 (14:52 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 26 Jun 2015 22:07:29 +0000 (22:07 +0000)
Fixes the build from https://golang.org/cl/4117 (sync: simplify WaitGroup)

Change-Id: Icc2a7ba8acea26fd187d52cf1901bfebf8573f93
Reviewed-on: https://go-review.googlesource.com/11591
Reviewed-by: Austin Clements <austin@google.com>
src/sync/export_test.go
src/sync/waitgroup_test.go

index fa5983a2d1e5d23ccf3abb0091a036b1badf5dbb..6f49b3bd8a8f790536fdc5659113cec7c43f14b3 100644 (file)
@@ -7,3 +7,5 @@ package sync
 // Export for testing.
 var Runtime_Semacquire = runtime_Semacquire
 var Runtime_Semrelease = runtime_Semrelease
+
+const RaceEnabled = raceenabled
index 06a77798d088d3d11e9a45a23c85dc20b150bdbd..d3329624fc360db8947c7fad1852a7c3556cf92f 100644 (file)
@@ -47,6 +47,12 @@ func TestWaitGroup(t *testing.T) {
        }
 }
 
+func knownRacy(t *testing.T) {
+       if RaceEnabled {
+               t.Skip("skipping known-racy test under the race detector")
+       }
+}
+
 func TestWaitGroupMisuse(t *testing.T) {
        defer func() {
                err := recover()
@@ -62,6 +68,7 @@ func TestWaitGroupMisuse(t *testing.T) {
 }
 
 func TestWaitGroupMisuse2(t *testing.T) {
+       knownRacy(t)
        if runtime.NumCPU() <= 2 {
                t.Skip("NumCPU<=2, skipping: this test requires parallelism")
        }
@@ -104,6 +111,7 @@ func TestWaitGroupMisuse2(t *testing.T) {
 }
 
 func TestWaitGroupMisuse3(t *testing.T) {
+       knownRacy(t)
        if runtime.NumCPU() <= 1 {
                t.Skip("NumCPU==1, skipping: this test requires parallelism")
        }