Repository navigation
test(rocprofv3): add interactive attach detach tests - #12055
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Readiness races and an ineffective zombie-process check can make the tests flaky or allow false positives.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds coverage for rocprofv3’s interactive Enter- and SIGINT-based detach workflows.
Changes:
- Registers Enter and SIGINT attachment scenarios.
- Adds execution, permission-skip, cleanup, and validation logic.
- Validates agent, kernel-dispatch, and HSA API output.
| File | Description |
|---|---|
attachment/CMakeLists.txt |
Registers the new suite. |
attach-detach/CMakeLists.txt |
Defines execution and validation tests. |
run_attachment_detach_test.sh |
Drives both interactive detach modes. |
validate.py |
Validates captured profiling data. |
conftest.py |
Loads JSON and handles skips. |
pytest.ini |
Configures pytest discovery. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
7d63acb to
9f4d504
Compare
PR Pundit review(Testing PR Pundit Code Review agent. Not all comments may be relevant. This is a one-time automated pass: please address what is useful, no need to request a re-review. Please reply to each point, whether it applies or not: we harvest these replies, and both kinds are enormously helpful for tuning the agent. Reach out to @peymanr for suggestions.)
1. 🟠 Should fix: Detach tests pass even if detach never stops tracing: validate.py checks only record presence
Who is affected: Only test coverage: a detach regression would pass in CI; no user-visible behaviour. Checked against the code by an independent pass. 2. 🟠 Should fix: Worst-case detach reports as ctest timeout and loses rocprofv3 log: unbounded waits under TIMEOUT 90
Who is affected: CI runs of rocprofv3-test-attachment-attach-detach-{enter,sigint} on a slow or loaded GPU host where Checked against the code by an independent pass. Shared from a pilot of PR Pundit, an agentic code reviewer that builds and tests the change and reads the project's past reviews. Reviewed at |
There was a problem hiding this comment.
🟡 Changes recommended
The test can falsely pass without Enter-triggered detachment, kill valid slow detachments, and fail instead of skipping in root containers lacking CAP_SYS_PTRACE.
3 open issues
1 resolved since last review
Review effort: Balanced
TheRock Submodule Bump ActivityNewest first
|

Motivation
rocprofv3supports two interactive ways to end an attachment: pressing Enter in the terminal where it runs, or sending it SIGINT. This is the documented default, with--attach-duration-msecas the timed alternative.Every existing attachment suite passes
--attach-duration-msec, so only the timed path is exercised. A regression in the interactive path would break the documented default workflow while the suites stayed green.Technical Details
Adds
tests/rocprofv3/attachment/attach-detach/, registering two scenarios from one driver. Both omit--attach-duration-msec, which is what selects the interactive path, and hold the profiler's stdin open through a FIFO so the prompt blocks rather than reaching EOF:enterwrites a newline to the FIFO to answer thePress Enter to detach...promptsigintsends SIGINT torocprofv3itselfEach scenario waits for the
Press Enter to detach...prompt before starting its settle interval. The prompt is printed only once attachment has completed and the SIGINT handler is installed, so a slow attach cannot consume the interval or receive the trigger early.The distinction from the existing suites is the signal target. They send SIGINT to the profiled application after the profiler has already detached on its timer; this sends it to the profiler, which is the path
rocprof-attachinstalls a handler for.Each scenario asserts the profiler exits cleanly, the target process is still running afterwards, and the flushed output contains agent, kernel dispatch, and HSA API records.
--attach-sync-outputis retained so output timing stays deterministic.The driver carries its own readiness wait and ptrace permission guard, matching the sibling attachment drivers, and skips when ptrace is unavailable.
Issue Tracking
JIRA ID: AIROCVAL-70
Test Plan
ctest -R "attach-detach"Requires a GPU and the ability to ptrace a non-descendant process; in a container the
SYS_PTRACEcapability is needed, as described in the process attachment guide. The suite skips when that is unavailable.Test Result
Run on an 8x MI300X (gfx942) node. Both scenarios attach, detach on their interactive trigger, and leave the target process running; all six validators pass against the captured output. With attachment artificially delayed beyond the settle interval, both scenarios still wait for the prompt and pass.
Submission Checklist