1
0
mirror of https://github.com/golang/go synced 2024-11-17 20:04:47 -07:00

net: ensure that Read/Write on all platforms do 0 mallocs

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12780045
This commit is contained in:
Dmitriy Vyukov 2013-08-21 14:21:02 +04:00
parent 06e686def6
commit 2f2d4c6bc3

View File

@ -456,12 +456,6 @@ func TestTCPReadWriteMallocs(t *testing.T) {
if testing.Short() {
t.Skip("skipping malloc count in short mode")
}
maxMallocs := 10000
switch runtime.GOOS {
// Add other OSes if you know how many mallocs they do.
case "windows":
maxMallocs = 0
}
ln, err := Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatalf("Listen failed: %v", err)
@ -493,8 +487,8 @@ func TestTCPReadWriteMallocs(t *testing.T) {
t.Fatalf("Read failed: %v", err)
}
})
if int(mallocs) > maxMallocs {
t.Fatalf("Got %v allocs, want %v", mallocs, maxMallocs)
if mallocs > 0 {
t.Fatalf("Got %v allocs, want 0", mallocs)
}
}