Stabilize the SOS test harness across platforms - #6000
Conversation
deafb71 to
d6e93e0
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
BoundedProcess.DrainOutput can throw when accessing Process.ExitCode during timeout-kill teardown, masking the intended timeout/failure diagnostics.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/tests/SOS.TestHarness/BoundedProcess.cs — DrainOutput assumes the process has an ExitCode, but in the timeout-kill path Terminate() only… |
What changed in this PR
This PR strengthens the SOS test harness’ cross-platform stability by introducing bounded child-process execution/drainage, tightening host pooling behavior, improving failure diagnostics, and making debuggee builds more RID/arch aware to reduce platform-specific flakes.
Changes:
- Introduce
BoundedProcessand migrate dump/capture call sites to bounded execution with concurrent stdout/stderr drainage. - Bound and pool resource-heavy dump hosts (LLDB + dotnet-dump), add clearer host/engine failure reporting, and improve LLDB/macOS integration.
- Add configuration validity/unit tests and make debuggee build outputs more RID/arch aware (including prebuilding net462 debuggees on Windows).
| File | Description |
|---|---|
| src/tests/SOS.UnitTests/Debuggees/SosHarnessScenarios/TestHarness.cs | Switch self-snapshotting to BoundedProcess to avoid hangs and improve error detail. |
| src/tests/SOS.UnitTests/Debuggees/SosHarnessScenarios/SosHarnessScenarios.csproj | Link BoundedProcess.cs into the debuggee for non-desktop TFMs. |
| src/tests/SOS.UnitTests/Debuggees/Directory.Build.props | Set a RID-aware default apphost runtime identifier for cross-target legs. |
| src/tests/SOS.Tests/TestConfigValidityTests.cs | Add unit tests for platform/config validity helpers and known failure classification. |
| src/tests/SOS.Tests/HostSlotTests.cs | Add tests for host-slot eviction and failure recovery behavior. |
| src/tests/SOS.Tests/BoundedProcessTests.cs | Add Linux-focused tests for concurrent drainage and process-group timeout handling. |
| src/tests/SOS.TestHarness/ToolPaths.cs | Prefer macOS sos-lldb, add harness-specific overrides, and add Xcode framework resolution + host runtime override. |
| src/tests/SOS.TestHarness/TestConfig.cs | Centralize additional validity constraints and expose helpers for test validation. |
| src/tests/SOS.TestHarness/Targets.cs | Ensure pooled host teardown covers LLDB as well as dotnet-dump. |
| src/tests/SOS.TestHarness/SOS.TestHarness.csproj | Add InternalsVisibleTo for the new SOS.Tests test project. |
| src/tests/SOS.TestHarness/SnapshotStore.cs | Use bounded execution for capture paths, add known-createdump-permission failure handling, and make debuggee builds RID/arch aware. |
| src/tests/SOS.TestHarness/RepoLayout.cs | Add a path helper for prebuilt net462 debuggee output. |
| src/tests/SOS.TestHarness/LldbLiveHost.cs | Add macOS-specific env var to keep debuggee exception mode consistent under LLDB. |
| src/tests/SOS.TestHarness/LldbHostBase.cs | Improve macOS LLDB environment setup and make stdout/stderr drainage/joining more robust. |
| src/tests/SOS.TestHarness/HostSlot.cs | Add a dedicated LLDB slot and strengthen host open/close behavior around failures. |
| src/tests/SOS.TestHarness/DumpSession.cs | Pool LLDB dump sessions via a capacity-1 slot similarly to dotnet-dump. |
| src/tests/SOS.TestHarness/DbgEngLiveHost.cs | Treat only second-chance exceptions as crash breaks for live dbgeng runs. |
| src/tests/SOS.TestHarness/DbgEngCapturer.cs | Require second-chance exception breaks when capturing crash dumps. |
| src/tests/SOS.TestHarness/ChildEngineClient.cs | Improve error reporting when EngineHost exits early and preserve stderr for diagnostics. |
| src/tests/SOS.TestHarness/BoundedProcess.cs | Add bounded, cross-platform process runner with optional Linux process-group isolation. |
| src/tests/dirs.proj | Pass TargetRid into debuggee build orchestration. |
| src/tests/Debuggees.proj | Add Windows net462 debuggee build target (with x86 support) and select applicable projects. |
| src/SOS/Strike/util.cpp | Fix SOS version info validation to check the queried version struct. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
d6e93e0 to
55c8d24
Compare
4710e57 to
e69e60f
Compare
e69e60f to
6d6539e
Compare
6d6539e to
87bbb1b
Compare
87bbb1b to
f97e722
Compare
f97e722 to
9a56f9e
Compare
## Summary - Restores the complete reviewed SOS test harness from [#5979](#5979) after its exact revert in [#6006](#6006). - Re-establishes this change as the new bottom layer beneath [#5999](#5999), [#6000](#6000), [#6001](#6001), and [#6002](#6002). - Temporarily excludes only `SOS.Tests` from local CI via `SkipTests` when `ContinuousIntegrationBuild` is true. Normal local builds and discovery remain enabled until the upper Helix layer moves execution out of local CI. ## Reconstruction proof - The baseline restoration commit `2c7616acc2be6b20cf377574fa52e40196f16ca7` has tree `5d2ab7a6990a8cdc2ff8a3d2ec7a29e373b99d54`, exactly matching the pre-revert commit `ec5af2a1a56c4d9348e7e92438bb2faf8684f15f`. - The only subsequent delta is five added lines in `src/tests/SOS.Tests/SOS.Tests.csproj` for the temporary CI-only skip. ## Validation - `./dotnet.sh build src/tests/SOS.Tests/SOS.Tests.csproj --no-restore --verbosity minimal` — succeeds with 0 warnings and 0 errors. - Focused Microsoft.Testing.Platform discovery for `SOS.Tests.PrintExceptionTests.PrintException_Data` with DotnetDump/Core/net10 constraints — 2 expected rows discovered without `ContinuousIntegrationBuild`. - MSBuild property evaluation: default `SkipTests` is empty; `-p:ContinuousIntegrationBuild=true` evaluates `SkipTests=true`. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c34cd9f4-d3b5-4b46-b7fc-e34b34bc88c3
9a56f9e to
9c0f240
Compare
## Summary - add a temporary test-only `sos-lldb` executable on macOS to host SOS through Apple LLDB reliably - keep the driver source and build target with native test helpers while staging the executable for SOS Helix tests - scope LLDB command-result routing with a reentrant RAII guard that restores the previous result - reject invalid LLDB thread IDs at the debugger-service boundary and retain an `E_UNEXPECTED` CLRMA backstop - stop batch execution and return a non-zero exit code when an LLDB command fails ## Why this layer is separate This PR contains only the standalone LLDB test-host layer from #5981. Keeping it separate from Helix sharding, harness, documentation, and dependency work makes the temporary host independently reviewable and provides the bottom layer for subsequent stacked changes. The executable is test infrastructure, is not included in SOS packages, and is temporary until the .NET 11 SDK contains the runtime fix that makes this Apple LLDB workaround unnecessary. ## Validation - `./build.sh -skipmanaged` (macOS arm64 Debug) - successful `sos-lldb --no-lldbinit --batch -o version` returns `0` - failed batch command returns `1` and prevents later `-o` commands from running - an interactive command failure remains nonfatal and later commands still run - invalid and missing argument checks return `2` - loaded `libsosplugin.dylib` through `sos-lldb` and ran `soshelp`, confirming plugin command output is routed through the scoped result --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9a6e90d9-5cd5-4ff1-a05b-11830076408d
|
/ba-g Next PR in the stack did not have the failure. Will create known issue if necessary. |
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Open the logical HKLM SOFTWARE path through the registry view matching the test process bitness, avoiding duplicate WOW6432Node redirection in x86 runs. Add focused coverage for both registry views. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5281acb1-f8c2-4264-9af1-d8489323b9ba
9c0f240 to
01cfd47
Compare
Pull Request is not mergeable
Pull Request is not mergeable

Stack layer 2 of the native decomposition for #5981.
Depends on #5999
This layer stabilizes the reusable SOS harness across hosts and architectures: bounded child-process capture and stream drainage, clearer child-host failures, bounded LLDB dump hosts, second-chance DbgEng crash handling, macOS
sos-lldbintegration, RID-aware debuggee builds, and focused platform/configuration validity checks.It intentionally excludes Helix submission and pipeline wiring, payload overlays, sharding, command-coverage migration, and legacy test deletion.
Validation:
dotnet build src/tests/SOS.Tests/SOS.Tests.csproj -c Debug -p:TargetArch=arm64 -p:TargetRid=osx-arm64 --no-restoreBoundedProcessTests,HostSlotTests, andTestConfigValidityTests(20 passed)dotnet publishfor theSosHarnessScenariossingle-fileosx-arm64debuggee./build.sh -skipmanaged -configuration Debug -architecture arm64