Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/runtime/pprof/pprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,6 @@ func BenchmarkGoroutine(b *testing.B) {
}

func TestGoroutineProfileDebug3Creators(t *testing.T) {
t.Skip("cockroach: known flaky on linux/amd64, see https://github.com/cockroachdb/cockroach/issues/165528")
// Create synthetic goroutines using the helper
cleanup := createSyntheticGoroutines(10, 2)
defer cleanup()
Expand Down Expand Up @@ -1985,9 +1984,11 @@ func TestGoroutineProfileDebug3Creators(t *testing.T) {
id := strconv.Itoa(int(s.NumLabel["go::goroutine"][0]))
got := s.NumLabel["go::goroutine_created_by"]
if createdBy[id] == "" {
if len(got) != 0 {
t.Fatalf("goroutine %s: got created_by %q, want none", id, got)
}
// debug=3 may report created_by for goroutines whose
// creating function is filtered by showframe in debug=2
// (e.g. runtime-internal goroutines). This is expected:
// debug=3 provides a superset of debug=2's created_by data.
continue
} else {
if e := createdBy[id]; len(got) != 1 || strconv.Itoa(int(got[0])) != e {
t.Fatalf("goroutine %s: got created_by %q, want %q", id, got, e)
Comment on lines 1986 to 1994

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if createdBy[id] == "" { continue } conflates “no entry in createdBy” with an (unexpected) empty creator value, which could hide parsing/format regressions. Consider using the map presence (e, ok := createdBy[id]) to decide whether to skip, and then compare against e.

If you want the test to more directly assert that debug=3 is a superset of debug=2, it’s also more robust to verify every createdBy entry exists in the parsed debug=3 samples (e.g., index samples by goroutine id and then iterate over createdBy), rather than iterating only over parsed.Sample.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, I think treating empty as missing is perfectly fine for the test's purposes and a shorter, more concise test is easier to read.

Expand Down
Loading