Skip to content

Commit

Permalink
fmt: skip malloc test under race detector
Browse files Browse the repository at this point in the history
Fixes golang#10778.

Change-Id: I09aab55dec429ec4a023e5ad591b929563cef0d9
Reviewed-on: https://go-review.googlesource.com/9855
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
josharian committed May 11, 2015
1 parent 7c0db1b commit e92a724
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/fmt/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/fmt/norace_test.go
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions src/fmt/race_test.go
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e92a724

Please sign in to comment.