Commit 21de1ab3 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

reflect: set GOMAXPROCS=1 in the malloc test

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
parent 804e562a
......@@ -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)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment