mirror of https://github.com/golang/go.git
net/http: disable an alloc test under the race detector
LGTM=dvyukov R=dvyukov CC=golang-codereviews https://golang.org/cl/70200052
This commit is contained in:
parent
dd89fb1876
commit
5f1e0fa538
|
|
@ -13,6 +13,8 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var raceEnabled = false // set by race.go
|
||||
|
||||
// A Header represents the key-value pairs in an HTTP header.
|
||||
type Header map[string][]string
|
||||
|
||||
|
|
|
|||
|
|
@ -192,9 +192,12 @@ func BenchmarkHeaderWriteSubset(b *testing.B) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHeaderWriteSubsetMallocs(t *testing.T) {
|
||||
func TestHeaderWriteSubsetAllocs(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping malloc count in short mode")
|
||||
t.Skip("skipping alloc test in short mode")
|
||||
}
|
||||
if raceEnabled {
|
||||
t.Skip("skipping test under race detector")
|
||||
}
|
||||
if runtime.GOMAXPROCS(0) > 1 {
|
||||
t.Skip("skipping; GOMAXPROCS>1")
|
||||
|
|
@ -204,6 +207,6 @@ func TestHeaderWriteSubsetMallocs(t *testing.T) {
|
|||
testHeader.WriteSubset(&buf, nil)
|
||||
})
|
||||
if n > 0 {
|
||||
t.Errorf("mallocs = %g; want 0", n)
|
||||
t.Errorf("allocs = %g; want 0", n)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build race
|
||||
|
||||
package http
|
||||
|
||||
func init() {
|
||||
raceEnabled = true
|
||||
}
|
||||
Loading…
Reference in New Issue