Skip to content

fix(go): keep benchmark headers out of quiet test failure output - #5220

Open
helmipradita wants to merge 1 commit into
rtk-ai:developfrom
helmipradita:fix/go-test-quiet-benchmark-header-5215
Open

helmipradita wants to merge 1 commit into
rtk-ai:developfrom
helmipradita:fix/go-test-quiet-benchmark-header-5215

Conversation

@helmipradita

Copy link
Copy Markdown
Contributor

Root cause

When go test runs with -v=false, test2json tags benchmark header lines (goos:, goarch:, pkg:, cpu:) with the failing benchmark's Test key. In select_go_test_failure_lines, the location-match capture logic treats the first such header (typically goos:) as context to keep after a failure line, so benchmark metadata leaks into quiet-mode failure output.

Fix

  • Add is_go_benchmark_header helper matching goos:, goarch:, pkg:, cpu: prefixes.
  • Skip benchmark header lines in select_go_test_failure_lines, clearing keep_next_context_line so they never get captured as context.
  • Exclude benchmark headers from the empty-relevant fallback.

Test

test_filter_go_test_failing_benchmark_quiet_omits_benchmark_headers — asserts failing benchmark output keeps the real failure line while omitting all benchmark headers.

Verification

  • cargo test --lib cmds::go::go_cmd::tests — 31 passed, 0 failed.
  • cargo fmt --all -- --check — clean.
  • cargo clippy --all-targets -- -D warnings — clean.

Fixes #5215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go-test: a failing benchmark in -v=false JSON shows Go's benchmark header as failure context

1 participant