]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: set GOMAXPROCS=1 in the malloc test
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 2 Jul 2012 16:55:08 +0000 (20:55 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 2 Jul 2012 16:55:08 +0000 (20:55 +0400)
Occasionally I see:
--- FAIL: TestAllocations-15 (0.00 seconds)
        all_test.go:1575: 6 mallocs after 100 iterations
Tested:
$ go test -cpu=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reflect

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

src/pkg/reflect/all_test.go

index e331405635a7f5d4ab6724f1079fbae67fe7cd83..3b6fd5e58517ab3b7175505275fd10126a017892 100644 (file)
@@ -1569,9 +1569,10 @@ func noAlloc(t *testing.T, n int, f func(int)) {
        }
        // A few allocs may happen in the testing package when GOMAXPROCS > 1, so don't
        // require zero mallocs.
+       // A new thread, one of which will be created if GOMAXPROCS>1, does 6 allocations.
        runtime.ReadMemStats(memstats)
        mallocs := memstats.Mallocs - oldmallocs
-       if mallocs > 5 {
+       if mallocs > 10 {
                t.Fatalf("%d mallocs after %d iterations", mallocs, n)
        }
 }