Skip to content

service/dap,pkg/debugdetect: fix tests - #4375

Merged
aarzilli merged 6 commits into
go-delve:masterfrom
derekparker:fix-tests
Jun 23, 2026
Merged

aarzilli merged 6 commits into
go-delve:masterfrom
derekparker:fix-tests

Conversation

@derekparker

Copy link
Copy Markdown
Member

Fix a few DAP / debugdetect tests that showed up in CI.

TestNextParked's helper function was not updated to handle the new
ExitedEvent that now precedes TerminatedEvent on process exit
(introduced in go-delve#4371).

The testNextParkedHelper loop continues until it finds a parked
goroutine. If the process exits before finding one, it should now
expect ExitedEvent followed by TerminatedEvent, not just
TerminatedEvent alone.

This follows the same pattern as the fix in de699e3 for
TestStepOutPreservesGoroutine.
The debugdetect tests used hardcoded listen addresses (40580, 40581)
which caused "address already in use" flakes when tests ran in
parallel on linux/arm64 in CI.

Now using 127.0.0.1:0 to let the OS assign a free port, with the
actual address parsed from dlv's stdout. This follows the same
pattern established in de699e3 for cmd/dlv tests.

Fixes TestIntegration_WaitForDebugger CI flake on linux/arm64.
TestFilterGoroutines was failing on Windows/amd64 because an extra
runtime.mcall goroutine appeared in the filtered results when using
the "-with user" filter. This goroutine, like runtime.goexit, doesn't
have a start location that the system filter can use to exclude it.

The test already had special handling for runtime.goexit on Windows
(added for Go 1.26). This extends that handling to also allow
runtime.mcall as an acceptable extra goroutine on Windows.

Fixes TestFilterGoroutines CI flake on windows/amd64.
Fixes a panic when attaching to an invalid process ID (e.g., -1).
Previously, when AttachPid was negative, it would not match the
condition `AttachPid > 0` and would fall through to the default case
which tried to Launch with empty processArgs, causing an index out of
range panic at debugger.go:273.

Now validates that AttachPid is non-negative before attempting to
attach, returning a proper error message instead of panicking.

Also updated TestBadAttachRequest to expect the proper error message
instead of testing that a panic occurs and is recovered.

Fixes panic in TestBadAttachRequest on linux/riscv64.
TestRangeOverFuncNext/TestPanickyIterator2 and
TestRangeOverFuncNextInlined/TestPanickyIterator2 experience flaky
timeouts on linux/riscv64. The test gets stuck in an infinite loop
during stepping, specifically at line 125 of rangeoverfunc.go during
a next operation in the panic recovery path.

This appears to be a riscv64-specific issue with stepping through
range-over-func iterators that panic. Skip both variants (inlined
and non-inlined) on riscv64 until the root cause can be investigated.

Fixes timeout in TestRangeOverFuncNext/TestPanickyIterator2 on
linux/riscv64.
TestSetVariable experiences flaky timeouts on linux/riscv64 during
process initialization. The test hangs in goroutineCache.init while
reading DWARF info via dwarf/reader.AddrFor, specifically during the
native.Launch process initialization phase.

Stack trace shows the hang occurs in:
  dwarf/reader.(*Reader).AddrFor
  proc.(*goroutineCache).init
  proc.(*TargetGroup).newTarget
  native.Launch

This appears to be a riscv64-specific issue with DWARF reading during
process startup, similar to the stepping timeout in TestPanickyIterator2.
Skip this test on riscv64 until the root cause can be investigated.

Fixes timeout in TestSetVariable on linux/riscv64.
@aarzilli
aarzilli merged commit 220314d into go-delve:master Jun 23, 2026
3 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
delve 1.27.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* service/dap: avoid Session.conn race in breakpoint-after-disconnect test by @alexsaezm in go-delve/delve#4317
* proc: implement frame pointer unwinding by @alexsaezm in go-delve/delve#4288
* proc: fix SP calculation for sigpanic frames on arm64 by @alexsaezm in go-delve/delve#4319
* native: propagate PtraceSetRegs error on linux/ppc64le by @cuiweixie in go-delve/delve#4321
* native: propagate PtraceGetRegs error on linux/ppc64le by @cuiweixie in go-delve/delve#4322
* proc: propagate AddrPiece ReadMemory errors in composite memory by @cuiweixie in go-delve/delve#4323
* proc/internal/ebpf: fix AddressToOffset off-by-one at section load by @cuiweixie in go-delve/delve#4324
* proc: fix OR handling in breakpointConditionSatisfiable by @cuiweixie in go-delve/delve#4325
* dwarf/reader: propagate errors during Reader entry iteration by @cuiweixie in go-delve/delve#4327
* proc: bail out of loadArrayValues after stride overflow by @cuiweixie in go-delve/delve#4328
* proc: compile hit-condition regexp once by @cuiweixie in go-delve/delve#4335
* service/dap: add newline to the build message by @sagg0t in go-delve/delve#4340
* proc: fix test for go1.27 regexp refactor by @aarzilli in go-delve/delve#4339
* proc: fix range over func stepping for go1.27 by @aarzilli in go-delve/delve#4343
* chore: fix some comments to improve readability by @box4wangjing in go-delve/delve#4344
* Teamcity: reenable riscv64 build by @aarzilli in go-delve/delve#4346
* proc: fix hasInlines in stacktrace, fix range step with inlining by @aarzilli in go-delve/delve#4345
* chore: fix comment to improve readability by @cuoguojida in go-delve/delve#4350
* service/dap: relax TestBadLaunchRequest by @aarzilli in go-delve/delve#4351
* TeamCity: adjust execution timeout by @vietage in go-delve/delve#4354
* proc/internal/ebpf: switch to header+param event ring buffer protocol by @derekparker in go-delve/delve#4352
* proc: add test for struct literals with embedded field selectors by @aarzilli in go-delve/delve#4362
* proc: disable some failing tests on riscv64 by @aarzilli in go-delve/delve#4361
* gobuild: increase wait length for deleting binaries on Windows by @aarzilli in go-delve/delve#4359
* proc: add test for accessing global C variables by @aarzilli in go-delve/delve#4358
* proc: support generic methods by @aarzilli in go-delve/delve#4356
* Revert "winarm64: remove experimental build tags (#4176)" by @aarzilli in go-delve/delve#4281
* proc/test: include GOEXPERIMENT in the fixture cache key  by @typesanitizer in go-delve/delve#4367
* proc: fix stepping test on go1.27 / arm64 by @aarzilli in go-delve/delve#4365
* service/dap: add dap write memory request handler by @DrSergei in go-delve/delve#4364
* proc: make PushPackageVarOrSelect check local variables first by @aarzilli in go-delve/delve#4181
* pkg/proc: add GOEXPERIMENT=mapsplitgroup support by @aarzilli in go-delve/delve#4370
* service/dap: send ExitedEvent before TerminatedEvent by @derekparker in go-delve/delve#4371
* service/dap: fix test failures from ExitedEvent change by @derekparker in go-delve/delve#4373
* service/dap,pkg/debugdetect: fix tests by @derekparker in go-delve/delve#4375
* v1.27.0 by @derekparker in go-delve/delve#4372

## New Contributors
* @sagg0t made their first contribution in go-delve/delve#4340
* @box4wangjing made their first contribution in go-delve/delve#4344
* @cuoguojida made their first contribution in go-delve/delve#4350

**Full Changelog**: go-delve/delve@v1.26.3...v1.27.0
**Curated Changelog**: https://github.com/go-delve/delve/blob/master/CHANGELOG.md#1270-2026-06-19</pre>
  <p>View the full release notes at <a href="https://github.com/go-delve/delve/releases/tag/v1.27.0">https://github.com/go-delve/delve/releases/tag/v1.27.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!12311
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.

2 participants