Commit 5f1e0fa5 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: disable an alloc test under the race detector

LGTM=dvyukov
R=dvyukov
CC=golang-codereviews
https://golang.org/cl/70200052
parent dd89fb18
......@@ -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)
}
}
// 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
}
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