]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make TestStackMem a little less flaky
authorRuss Cox <rsc@golang.org>
Fri, 8 Mar 2013 16:25:21 +0000 (11:25 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 8 Mar 2013 16:25:21 +0000 (11:25 -0500)
Have seen failures with GOMAXPROCS=4 on Windows.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7626043

src/pkg/runtime/stack_test.go

index 759f7c46ed058c952d65b64b82385541c41cb20f..74f29f34ec02a8b34f40308a9837ee498059b737 100644 (file)
@@ -1533,7 +1533,7 @@ func stack5000() (uintptr, uintptr) { var buf [5000]byte; use(buf[:]); return St
 func TestStackMem(t *testing.T) {
        const (
                BatchSize      = 32
-               BatchCount     = 512
+               BatchCount     = 256
                ArraySize      = 1024
                RecursionDepth = 128
        )
@@ -1562,6 +1562,11 @@ func TestStackMem(t *testing.T) {
                for i := 0; i < BatchSize; i++ {
                        <-c
                }
+
+               // The goroutines have signaled via c that they are ready to exit.
+               // Give them a chance to exit by sleeping. If we don't wait, we
+               // might not reuse them on the next batch.
+               time.Sleep(10 * time.Millisecond)
        }
        s1 := new(MemStats)
        ReadMemStats(s1)