Skip to content

Commit 2c0a0fc

Browse files
prattmicgopherbot
authored andcommitted
[release-branch.go1.23] runtime: skip TestCgoCallbackPprof on platforms with broken profiling
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 #72871. Change-Id: I6a6a636cbf6b16abcbba8771178fe1d001be9d9b Reviewed-on: https://go-review.googlesource.com/c/go/+/658415 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/go/+/658435 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Bypass: Dmitri Shuralyov <[email protected]>
1 parent c855149 commit 2c0a0fc

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

Diff for: src/internal/testenv/testenv.go

+23
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,26 @@ func ParallelOn64Bit(t *testing.T) {
522522
}
523523
t.Parallel()
524524
}
525+
526+
// CPUProfilingBroken returns true if CPU profiling has known issues on this
527+
// platform.
528+
func CPUProfilingBroken() bool {
529+
switch runtime.GOOS {
530+
case "plan9":
531+
// Profiling unimplemented.
532+
return true
533+
case "aix":
534+
// See https://golang.org/issue/45170.
535+
return true
536+
case "ios", "dragonfly", "netbsd", "illumos", "solaris":
537+
// See https://golang.org/issue/13841.
538+
return true
539+
case "openbsd":
540+
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
541+
// See https://golang.org/issue/13841.
542+
return true
543+
}
544+
}
545+
546+
return false
547+
}

Diff for: src/runtime/crash_cgo_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func TestCgoCallbackPprof(t *testing.T) {
8282
case "plan9", "windows":
8383
t.Skipf("no pthreads on %s", runtime.GOOS)
8484
}
85+
if testenv.CPUProfilingBroken() {
86+
t.Skip("skipping on platform with broken profiling")
87+
}
8588

8689
got := runTestProg(t, "testprogcgo", "CgoCallbackPprof")
8790
if want := "OK\n"; got != want {

Diff for: src/runtime/pprof/pprof_test.go

+1-22
Original file line numberDiff line numberDiff line change
@@ -415,27 +415,6 @@ func parseProfile(t *testing.T, valBytes []byte, f func(uintptr, []*profile.Loca
415415
return p
416416
}
417417

418-
func cpuProfilingBroken() bool {
419-
switch runtime.GOOS {
420-
case "plan9":
421-
// Profiling unimplemented.
422-
return true
423-
case "aix":
424-
// See https://golang.org/issue/45170.
425-
return true
426-
case "ios", "dragonfly", "netbsd", "illumos", "solaris":
427-
// See https://golang.org/issue/13841.
428-
return true
429-
case "openbsd":
430-
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
431-
// See https://golang.org/issue/13841.
432-
return true
433-
}
434-
}
435-
436-
return false
437-
}
438-
439418
// testCPUProfile runs f under the CPU profiler, checking for some conditions specified by need,
440419
// as interpreted by matches, and returns the parsed profile.
441420
func testCPUProfile(t *testing.T, matches profileMatchFunc, f func(dur time.Duration)) *profile.Profile {
@@ -453,7 +432,7 @@ func testCPUProfile(t *testing.T, matches profileMatchFunc, f func(dur time.Dura
453432
t.Skip("skipping on wasip1")
454433
}
455434

456-
broken := cpuProfilingBroken()
435+
broken := testenv.CPUProfilingBroken()
457436

458437
deadline, ok := t.Deadline()
459438
if broken || !ok {

0 commit comments

Comments
 (0)