]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make a test more robust
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 15 Jul 2014 06:30:12 +0000 (10:30 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 15 Jul 2014 06:30:12 +0000 (10:30 +0400)
The issue is discovered during testing of a change to runtime.
Even if it is unlikely to happen, the comment can safe an hour
next person who hits it.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://golang.org/cl/116790043

src/pkg/runtime/proc_test.go

index 5be3551950c2dbdd0d47e69ad43ef650684490c8..1f597f58e4a78ab897382186be7075ddcb75d3f4 100644 (file)
@@ -101,6 +101,10 @@ func TestGoroutineParallelism(t *testing.T) {
                N = 3
        }
        defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P))
+       // If runtime triggers a forced GC during this test then it will deadlock,
+       // since the goroutines can't be stopped/preempted.
+       // So give this test as much time as possible.
+       runtime.GC()
        for try := 0; try < N; try++ {
                done := make(chan bool)
                x := uint32(0)