// Check that profile is well formed and contains need.
have := make([]uintptr, len(need))
+ var samples uintptr
parseProfile(t, prof.Bytes(), func(count uintptr, stk []uintptr) {
+ samples += count
for _, pc := range stk {
f := runtime.FuncForPC(pc)
if f == nil {
}
}
})
+ t.Logf("total %d CPU profile samples collected", samples)
if len(need) == 0 {
return
}
}
+// Fork can hang if preempted with signals frequently enough (see issue 5517).
+// Ensure that we do not do this.
func TestCPUProfileWithFork(t *testing.T) {
if runtime.GOOS == "darwin" {
if runtime.GOARCH == "arm" {
}
}
- // Fork can hang if preempted with signals frequently enough (see issue 5517).
- // Ensure that we do not do this.
heap := 1 << 30
+ if runtime.GOOS == "android" {
+ // Use smaller size for Android to avoid crash.
+ heap = 100 << 20
+ }
if testing.Short() {
heap = 100 << 20
}
defer StopCPUProfile()
for i := 0; i < 10; i++ {
- exec.Command("go").CombinedOutput()
+ exec.Command(os.Args[0], "-h").CombinedOutput()
}
}