]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/pprof,runtime/pprof: disable test on more broken platforms
authorMichael Pratt <mpratt@google.com>
Thu, 17 Jun 2021 19:23:53 +0000 (15:23 -0400)
committerMichael Pratt <mpratt@google.com>
Thu, 17 Jun 2021 21:58:54 +0000 (21:58 +0000)
runtime/pprof has a more complete list of platforms with broken
profiling than I used in cmd/pprof in https://golang.org/cl/325809.
Duplicate that list in cmd/pprof and clean it up a bit in runtime/pprof
for easier reference.

Change-Id: I8f2580aac223de9b73cfff4355f49916f7b76493
Reviewed-on: https://go-review.googlesource.com/c/go/+/329149
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/pprof/pprof_test.go
src/runtime/pprof/pprof_test.go

index 170cdf3bb81d073abb25120ed3052680bca555b3..11e251bfde2654e0e015d645ef2251dc6d2679d5 100644 (file)
@@ -54,6 +54,22 @@ func buildPprof() error {
        return nil
 }
 
+// See also runtime/pprof.cpuProfilingBroken.
+func mustHaveCPUProfiling(t *testing.T) {
+       switch runtime.GOOS {
+       case "plan9":
+               t.Skipf("skipping on %s, unimplemented", runtime.GOOS)
+       case "aix":
+               t.Skipf("skipping on %s, issue 45170", runtime.GOOS)
+       case "ios", "dragonfly", "netbsd", "illumos", "solaris":
+               t.Skipf("skipping on %s, issue 13841", runtime.GOOS)
+       case "openbsd":
+               if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
+                       t.Skipf("skipping on %s/%s, issue 13841", runtime.GOOS, runtime.GOARCH)
+               }
+       }
+}
+
 func mustHaveDisasm(t *testing.T) {
        switch runtime.GOARCH {
        case "mips", "mipsle", "mips64", "mips64le":
@@ -77,6 +93,7 @@ func mustHaveDisasm(t *testing.T) {
 //
 // This is a regression test for issue 46636.
 func TestDisasm(t *testing.T) {
+       mustHaveCPUProfiling(t)
        mustHaveDisasm(t)
        testenv.MustHaveGoBuild(t)
 
index 7cbb4fc7ae4e41ea7fdac596254ee206ee0807a6..f6ae15daabf890c8bfdb3db1a6d67a12c74fd8b0 100644 (file)
@@ -260,6 +260,27 @@ func parseProfile(t *testing.T, valBytes []byte, f func(uintptr, []*profile.Loca
        return p
 }
 
+func cpuProfilingBroken() bool {
+       switch runtime.GOOS {
+       case "plan9":
+               // Profiling unimplemented.
+               return true
+       case "aix":
+               // See https://golang.org/issue/45170.
+               return true
+       case "ios", "dragonfly", "netbsd", "illumos", "solaris":
+               // See https://golang.org/issue/13841.
+               return true
+       case "openbsd":
+               if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
+                       // See https://golang.org/issue/13841.
+                       return true
+               }
+       }
+
+       return false
+}
+
 // testCPUProfile runs f under the CPU profiler, checking for some conditions specified by need,
 // 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 {
@@ -275,16 +296,7 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri
                t.Skip("skipping on plan9")
        }
 
-       broken := false
-       switch runtime.GOOS {
-       // See https://golang.org/issue/45170 for AIX.
-       case "ios", "dragonfly", "netbsd", "illumos", "solaris", "aix":
-               broken = true
-       case "openbsd":
-               if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
-                       broken = true
-               }
-       }
+       broken := cpuProfilingBroken()
 
        maxDuration := 5 * time.Second
        if testing.Short() && broken {