From: Josh Bleecher Snyder Date: Mon, 11 May 2015 17:38:24 +0000 (-0700) Subject: fmt: skip malloc test under race detector X-Git-Tag: go1.5beta1~644 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e92a7247faee31985680f110ff429df484963487;p=gostls13.git fmt: skip malloc test under race detector Fixes #10778. Change-Id: I09aab55dec429ec4a023e5ad591b929563cef0d9 Reviewed-on: https://go-review.googlesource.com/9855 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/fmt/fmt_test.go b/src/fmt/fmt_test.go index ba99cb0f6a..f15a0ba8e8 100644 --- a/src/fmt/fmt_test.go +++ b/src/fmt/fmt_test.go @@ -949,11 +949,13 @@ var mallocTest = []struct { var _ bytes.Buffer func TestCountMallocs(t *testing.T) { - if testing.Short() { + switch { + case testing.Short(): t.Skip("skipping malloc count in short mode") - } - if runtime.GOMAXPROCS(0) > 1 { + case runtime.GOMAXPROCS(0) > 1: t.Skip("skipping; GOMAXPROCS>1") + case raceenabled: + t.Skip("skipping malloc count under race detector") } for _, mt := range mallocTest { mallocs := testing.AllocsPerRun(100, mt.fn) diff --git a/src/fmt/norace_test.go b/src/fmt/norace_test.go new file mode 100644 index 0000000000..1267cc34ee --- /dev/null +++ b/src/fmt/norace_test.go @@ -0,0 +1,9 @@ +// Copyright 2015 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 fmt_test + +const raceenabled = false diff --git a/src/fmt/race_test.go b/src/fmt/race_test.go new file mode 100644 index 0000000000..ae3147a5b0 --- /dev/null +++ b/src/fmt/race_test.go @@ -0,0 +1,9 @@ +// Copyright 2015 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 fmt_test + +const raceenabled = true