aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-02-19 05:42:20 -0500
committerRuss Cox <rsc@golang.org>2021-02-19 15:31:06 +0000
commitfa18f224c378f5831210077944e5df718efb8df5 (patch)
tree5bb094fc2bec5d7d8f8f4e5693f3e3916feb5c49 /src
parent01eb70e3dd4d7bf00ee915841e6b3c56fc94fe44 (diff)
downloadgo-fa18f224c378f5831210077944e5df718efb8df5.tar.xz
runtime/pprof: disable TestMorestack on macOS under race detector
This is failing but only under the race detector. It doesn't really seem fair to expect pprof to find specific profile events with the race detector slowing everything down anyway. Change-Id: I4b353d3d63944c87884d117e07d119b2c7bf4684 Reviewed-on: https://go-review.googlesource.com/c/go/+/294071 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/pprof/pprof_test.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index d7571953a9..168c1d4496 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -11,6 +11,7 @@ import (
"context"
"fmt"
"internal/profile"
+ "internal/race"
"internal/testenv"
"io"
"math/big"
@@ -261,18 +262,13 @@ func parseProfile(t *testing.T, valBytes []byte, f func(uintptr, []*profile.Loca
// as interpreted by matches, and returns the parsed profile.
func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []string, f func(dur time.Duration)) *profile.Profile {
switch runtime.GOOS {
- case "darwin", "ios":
- switch runtime.GOARCH {
- case "arm64":
- // nothing
- default:
- out, err := exec.Command("uname", "-a").CombinedOutput()
- if err != nil {
- t.Fatal(err)
- }
- vers := string(out)
- t.Logf("uname -a: %v", vers)
+ case "darwin":
+ out, err := exec.Command("uname", "-a").CombinedOutput()
+ if err != nil {
+ t.Fatal(err)
}
+ vers := string(out)
+ t.Logf("uname -a: %v", vers)
case "plan9":
t.Skip("skipping on plan9")
}
@@ -588,6 +584,13 @@ func stackContainsAll(spec string, count uintptr, stk []*profile.Location, label
}
func TestMorestack(t *testing.T) {
+ if runtime.GOOS == "darwin" && race.Enabled {
+ // For whatever reason, using the race detector on macOS keeps us
+ // from finding the newstack/growstack calls in the profile.
+ // Not worth worrying about.
+ // https://build.golang.org/log/280d387327806e17c8aabeb38b9503dbbd942ed1
+ t.Skip("skipping on darwin race detector")
+ }
testCPUProfile(t, stackContainsAll, []string{"runtime.newstack,runtime/pprof.growstack"}, avoidFunctions(), func(duration time.Duration) {
t := time.After(duration)
c := make(chan bool)