}
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
+}
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 {
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 {
t.Skip("skipping on wasip1")
}
- broken := cpuProfilingBroken()
+ broken := testenv.CPUProfilingBroken()
deadline, ok := t.Deadline()
if broken || !ok {