Repository navigation
udb: add DAP test client - #582
JosephAbdo wants to merge 9 commits into
Conversation
Greptile SummaryThis PR introduces a DAP test client ( The remaining findings are all P2: Confidence Score: 5/5Safe to merge; all remaining findings are P2 style/maintainability issues that do not block correctness. The previously flagged P0/P1 issues (fail_test propagation, runInTerminal slice off-by-one, disconnectPending, Makefile missing rules) are resolved in the current code. Only P2 suggestions remain: reversed test ordering for dataBreakpoint tests, duplicate source files, and silent retries. tests/udb/adapter.icn and uni/udb/test_adapter.icn — two copies of the same client that must be kept in sync. Important Files Changed
Sequence DiagramsequenceDiagram
participant TC as DAP_TestClient
participant UA as udb Adapter
participant UDB as udb --dapproxy
TC->>UA: initialize
UA-->>TC: response (capabilities)
UA-->>TC: event: initialized
TC->>UA: launch {program}
UA-->>TC: request: runInTerminal {udb --dapproxy PORT}
TC->>UDB: system(udb --dapproxy PORT &)
TC-->>UA: response: runInTerminal {shellProcessId}
UA-->>TC: response: launch (success)
TC->>UA: setBreakpoints
UA-->>TC: response (verified breakpoints)
TC->>UA: setDataBreakpoints
UA-->>TC: response (watchpoints)
TC->>UA: dataBreakpointInfo
UA-->>TC: response {dataId, accessTypes}
TC->>UA: configurationDone
UA-->>TC: response (ack)
UA-->>TC: event: stopped (breakpoint hit)
TC->>UA: threads / stackTrace / scopes / variables / setVariable / evaluate
UA-->>TC: responses
TC->>UA: continue
UA-->>TC: response (ack)
TC->>UA: next / stepIn / stepOut
UA-->>TC: responses (ack)
TC->>UA: disconnect
UA-->>TC: response (ack)
UA->>UA: disconnect() then exit()
Prompt To Fix All With AIThis is a comment left during a code review.
Path: tests/udb/adapter.icn
Line: 581-586
Comment:
**`setDataBreakpoints` runs before `dataBreakpointInfo` in `run_tests()`**
The DAP protocol intends `dataBreakpointInfo` to be called first to obtain the opaque `dataId` that is then passed to `setDataBreakpoints`. Here the order is reversed: `test_setDataBreakpoints` runs first (line 582) and hardcodes `dataId := "i"`, then `test_dataBreakpointInfo` (line 583) fires afterward. This works incidentally because the adapter's `watchpoint_info` simply reflects the `name` back as `dataId`, but it means the test doesn't exercise the real client workflow and would silently succeed even if the adapter stopped returning a `dataId` altogether.
Consider swapping the two test calls so the golden-file ordering also matches the intended protocol sequence.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: tests/udb/adapter.icn
Line: 1-7
Comment:
**Duplicate test client source with diverging paths**
`tests/udb/adapter.icn` and `uni/udb/test_adapter.icn` are almost identical; they differ only in the path used to locate `udb`/`unicon` (`../../bin/` vs `./`) and in whether `main()` compiles the test target at runtime. Any future logic change to one file must be manually replicated in the other, which is error-prone. Consider having `tests/udb/Makefile` compile `uni/udb/test_adapter.icn` directly (with a path override), or factoring the shared logic into a linked file, to avoid drift between the two copies.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: tests/udb/adapter.icn
Line: 45-55
Comment:
**Silent retry loop in compiled copy**
`uni/udb/test_adapter.icn` emits `"Retrying adapter startup with another port..."` on each retry attempt — useful for diagnosing flaky CI runs. The `tests/udb/adapter.icn` version (which is the one actually compiled and run) omits that write, so retry attempts are completely silent. Since stdout is compared against a golden file, suppressing the message from stdout makes sense, but consider redirecting it to stderr so failures during retry are still diagnosable.
How can I resolve this? If you propose a fix, please make it concise.Reviews (9): Last reviewed commit: "Merge branch 'master' into dap_test_clie..." | Re-trigger Greptile |
|
@greptile review |
Jafaral
left a comment
There was a problem hiding this comment.
Could use some refactoring just simplify the code a bit.
68d0a93 to
87b64f6
Compare
|
@greptile review |
Jafaral
left a comment
There was a problem hiding this comment.
Thanks for fixing the issues found in the review!
Jafaral
left a comment
There was a problem hiding this comment.
It maybe easier if we leave all other tests alone in this PR. Mixing all udb changes with all tests changes is hard to follow., especially with all of the change churns form one commit to the next. So, let us focus one one task here. The PR says add a DAP test client, let us keep it at that.
56217d6 to
9da6342
Compare
Signed-off-by: Joseph Abdo <[email protected]>
… target Signed-off-by: Joseph Abdo <[email protected]>
Expand the adapter test client to cover breakpoints, stack traces, scopes, variables, evaluation, and stepping requests. Signed-off-by: Joseph Abdo <[email protected]>
Signed-off-by: Joseph Abdo <[email protected]>
Signed-off-by: Joseph Abdo <[email protected]>
Move the adapter test into tests/udb and integrate it with the automated UDB test suite. Update the UDB suite Makefile to build and run the adapter test. Align the UDB suite output with other test suites by standardizing result formatting and integrating it into the top-level summary. Signed-off-by: Joseph Abdo <[email protected]>
Signed-off-by: Joseph Abdo <[email protected]>
Signed-off-by: Joseph Abdo <[email protected]>
1398210 to
c90aeff
Compare
43628d4 to
2587a65
Compare
Signed-off-by: Joseph Abdo <[email protected]>
2587a65 to
8a494af
Compare
Add a DAP test client, includes request coverage for: