]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.24] runtime: skip TestCgoCallbackPprof on platforms with broken...
authorMichael Pratt <mpratt@google.com>
Mon, 17 Mar 2025 12:11:42 +0000 (12:11 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 25 Mar 2025 18:51:27 +0000 (11:51 -0700)
CL 658035 added TestCgoCallbackPprof, which is consistently failing on
solaris. runtime/pprof maintains a list of platforms where CPU profiling
does not work properly. Since this test requires CPU profiling, skip the
this test on those platforms.

For #72870.
For #72876.
For #72872.

Change-Id: I6a6a636cbf6b16abcbba8771178fe1d001be9d9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/658415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/658416
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/internal/testenv/testenv.go
src/runtime/crash_cgo_test.go
src/runtime/pprof/pprof_test.go

index 9aecfaa69505a50120b85d8af599491dae3595b1..ac65ce53fbaeca778f4cdeb3773cf92965e27d6a 100644 (file)
@@ -504,3 +504,26 @@ func ParallelOn64Bit(t *testing.T) {
        }
        t.Parallel()
 }
+
+// CPUProfilingBroken returns true if CPU profiling has known issues on this
+// platform.
+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
+}
index a7321f49a5e97fa0e8afa98f3b3acdb8d3406cb7..83ac0a3d5e0e265940391d5101a20eb2ef9fbcc6 100644 (file)
@@ -78,6 +78,9 @@ func TestCgoCallbackPprof(t *testing.T) {
        case "plan9", "windows":
                t.Skipf("no pthreads on %s", runtime.GOOS)
        }
+       if testenv.CPUProfilingBroken() {
+               t.Skip("skipping on platform with broken profiling")
+       }
 
        got := runTestProg(t, "testprogcgo", "CgoCallbackPprof")
        if want := "OK\n"; got != want {
index bba66ba48fea352010124897c8dd237e1ce19e3c..8a1d8e2d1fa1d7ed89252444c4d193984ee11c1e 100644 (file)
@@ -416,27 +416,6 @@ 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 profileMatchFunc, f func(dur time.Duration)) *profile.Profile {
@@ -454,7 +433,7 @@ func testCPUProfile(t *testing.T, matches profileMatchFunc, f func(dur time.Dura
                t.Skip("skipping on wasip1")
        }
 
-       broken := cpuProfilingBroken()
+       broken := testenv.CPUProfilingBroken()
 
        deadline, ok := t.Deadline()
        if broken || !ok {