Skip to content

fix(tools): profile-heap refuses a --bench-filter that matches no benchmark before starting heaptrack (#2987) - #3017

Merged
mgradwohl merged 2 commits into
mainfrom
fix/profile-heap-empty-filter-2987
Oct 26, 2026
Merged

mgradwohl merged 2 commits into
mainfrom
fix/profile-heap-empty-filter-2987

Conversation

@mgradwohl

Copy link
Copy Markdown
Owner

Description

Fixes #2987

tools/profile-heap.sh bench announced a successful allocation capture when --bench-filter matched no benchmark. Google Benchmark exits 0 in that case, and heaptrack then recorded only startup and registration as though they were the workload. Bench mode now lists the matches first (--benchmark_list_tests=true, as profile-perf.sh already does) and fails before starting heaptrack when there are none. Several matches are fine for a heap capture, unlike perf's time sampling, so only an empty selection is refused.

PR Size

✅ Small (~15 lines of script, ~100 of test).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have run pre-commit run --all-files or installed pre-commit hooks (shellcheck included)
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass

Testing

New tests/tools/test_profile_heap_sh.py, registered as CTest ProfileHeapShScript on Linux, runs a copy of the script against a stub benchmark binary and a stub heaptrack that records being started:

  • a filter that matches nothing fails, with heaptrack never started and no "Capture complete";
  • a filter that matches is captured.

Both pass.

Additional Notes

v0.10.0, no backport (the issue's milestone).

🤖 Generated with Claude Code

…chmark before starting heaptrack (#2987)

Google Benchmark exits 0 when its filter matches nothing, and heaptrack then
recorded only startup and registration, which the script announced as the
capture. As profile-perf.sh already does, bench mode lists the matches first
and fails when there are none. Tested against a stub benchmark binary and a
stub heaptrack (tests/tools/test_profile_heap_sh.py).

Fixes #2987

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgradwohl mgradwohl added this to the v0.10.0 milestone Oct 26, 2026
@mgradwohl mgradwohl added bug Something isn't working tooling Developer tooling, CI, editor config, and automation agent:WSL Owned by the Linux/WSL Claude session (bug-fix conveyor) labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@mgradwohl
mgradwohl marked this pull request as ready for review October 26, 2026 04:52
@mgradwohl
mgradwohl enabled auto-merge (squash) October 26, 2026 04:52
…y-filter-2987

# Conflicts:
#	tests/CMakeLists.txt
@mgradwohl
mgradwohl disabled auto-merge October 26, 2026 05:13
@mgradwohl
mgradwohl enabled auto-merge (squash) October 26, 2026 05:13
@mgradwohl
mgradwohl merged commit 1798f76 into main Oct 26, 2026
24 checks passed
@mgradwohl
mgradwohl deleted the fix/profile-heap-empty-filter-2987 branch October 26, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:WSL Owned by the Linux/WSL Claude session (bug-fix conveyor) bug Something isn't working testing tooling Developer tooling, CI, editor config, and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Heap profiler reports success when the benchmark filter matches no workload

1 participant