Stabilize and migrate SOS harness coverage - #6001
Conversation
0a60d3a to
a92c1df
Compare
a92c1df to
b93dcf9
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The updated PrintExceptionTests/ClrmaExceptionMatrix include heap-less Mini dumps (DumpKind.All) while asserting heap-dependent exception/message data, likely causing failures or flakiness.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/tests/SOS.Tests/DiagnosticCommandTests.cs — Clrma_ReportsCurrentExceptionChain asserts the current exception chain, which likely depends on… |
|
src/tests/SOS.Tests/PrintExceptionTests.cs — These PrintException assertions require managed heap data (exception object + message strings).… |
What changed in this PR
This PR continues the SOS native test-stack migration by retiring several legacy SOS.UnitTests script-driven exception scenarios and re-homing their assertions into the stabilized SOS.Tests harness, while also refining matrix capability filters and improving cross-platform correctness (including .NET 11 + SingleFile + cDAC scenarios).
Changes:
- Retires legacy
DivZero,SimpleThrow, andNestedExceptionTestscript entry points and replaces their coverage with focusedSOS.Testsscenarios and oracles. - Introduces explicit capability/matrix filters (heap enumeration, current-thread constraints, ICorDebug stack-walk constraints) and adds targeted macOS/dotnet-dump skips for known platform gaps.
- Extends and hardens parsing/inspection coverage (e.g.,
clruoffsets parsing,gcinfolegacy encoding parsing, notreachableinrange slot-range oracle, architecture-correct register assertions).
| File | Description |
|---|---|
| src/tests/SOS.UnitTests/SOS.cs | Removes legacy script-backed test entry points for retired scenarios. |
| src/tests/SOS.UnitTests/Scripts/SimpleThrow.script | Deletes legacy script now covered by harness-based tests. |
| src/tests/SOS.UnitTests/Scripts/NestedExceptionTest.script | Deletes legacy script now covered by harness-based tests (incl. CLRMA coverage). |
| src/tests/SOS.UnitTests/Scripts/DivZero.script | Deletes legacy script now covered by harness-based tests. |
| src/tests/SOS.UnitTests/Debuggees/SosHarnessScenarios/SosHarnessScenarios.cs | Adds ObjectReference/array to provide a deterministic pointer-slot range for notreachableinrange. |
| src/tests/SOS.Tests/TestMatrixCapabilityTests.cs | Adds unit tests validating matrix capability predicates and parsing helpers. |
| src/tests/SOS.Tests/TestMatrices.cs | Adds capability filters and a macOS/dotnet-dump thread skip helper; expands matrix-building helpers. |
| src/tests/SOS.Tests/TestConfigValidityTests.cs | Updates validity expectations to allow .NET 11 SingleFile + cDAC. |
| src/tests/SOS.Tests/StackInspectionTests.cs | Narrows matrix to configs where current-thread commands are meaningful; adds macOS/dotnet-dump skip. |
| src/tests/SOS.Tests/SpecializedInspectionTests.cs | Adds targeted skip for known macOS .NET 11 legacy-DAC dump limitations. |
| src/tests/SOS.Tests/RuntimeInfoTests.cs | Makes registers assertions architecture-aware (esp/rsp/sp). |
| src/tests/SOS.Tests/README.md | Updates documentation to reflect SingleFile support with cDAC on .NET 11+. |
| src/tests/SOS.Tests/PrintExceptionTests.cs | Replaces script assertions with structured, focused printexception tests across matrices. |
| src/tests/SOS.Tests/ObjectInspectionTests.cs | Makes object size assertion pointer-size aware. |
| src/tests/SOS.Tests/NativeAddressSpaceTests.cs | Switches notreachableinrange oracle to scan an actual object-reference slot range and filters progress lines. |
| src/tests/SOS.Tests/MiscCommandTests.cs | Ensures dbgout is turned off via finally; refines host/DAC exclusions for enummem. |
| src/tests/SOS.Tests/MemoryAndDecodeTests.cs | Fixes dp/dq assertions for 32-bit by validating split 32-bit halves. |
| src/tests/SOS.Tests/GcWhereTests.cs | Uses current-thread-capable matrices for gcwhere tests. |
| src/tests/SOS.Tests/GcInspectionTests.cs | Adjusts stop point for verifyheap and adds targeted macOS legacy-DAC skip. |
| src/tests/SOS.Tests/EeHeapTests.cs | Strengthens assertions by requiring ranges per generation rather than concatenated segments. |
| src/tests/SOS.Tests/EeHeapParsing.cs | Refines regions-vs-segments detection and clarifies documentation. |
| src/tests/SOS.Tests/DumpHeapStringsTests.cs | Uses heap-enumeration capability filtering for dumpheap -strings coverage. |
| src/tests/SOS.Tests/DiagnosticCommandTests.cs | Adds CLRMA exception-chain coverage and macOS/dotnet-dump skips. |
| src/tests/SOS.Tests/COVERAGE.md | Updates migration/retirement mapping and rationale for retired scripts. |
| src/tests/SOS.Tests/CodeInfoTests.cs | Makes transition assertions tolerant of legacy x86 wording differences. |
| src/tests/SOS.Tests/CodeCommandParsingTests.cs | Adds focused unit tests for clru/gcinfo parsing edge cases (offset/no-offset, legacy encodings). |
| src/tests/SOS.Tests/CodeCommandParsing.cs | Improves clru parsing to be offset-mode aware; enhances gcinfo parsing for legacy formats and transitions. |
| src/tests/SOS.Tests/ClrUTests.cs | Adjusts source-annotation expectations and transition marker for x86/legacy encoding. |
| src/tests/SOS.Tests/ClrStackTests.cs | Applies macOS/dotnet-dump skip and adds capability filtering for GC-root enumeration. |
| src/tests/SOS.Tests/ClrStackLinesTests.cs | Strengthens source-line assertions (including line-number sets where variability exists) and uses live opt-in. |
| src/tests/SOS.Tests/ClrStackICorDebugTests.cs | Uses explicit capability filter for known unsupported ICorDebug stack-walk combinations; adds macOS/dotnet-dump skip. |
| src/tests/SOS.Tests/ClrStackFullTests.cs | Adds macOS/dotnet-dump skip. |
| src/tests/SOS.Tests/ClrStackFrameCountTests.cs | Adds macOS/dotnet-dump skip. |
| src/tests/SOS.Tests/ClrStackArgsLocalsTests.cs | Adds macOS/dotnet-dump skip. |
| src/tests/SOS.Tests/ClrStackAllThreadsTests.cs | Adds macOS/dotnet-dump skip. |
| src/tests/SOS.TestHarness/TestConfig.cs | Updates DAC support rules to allow SingleFile + cDAC starting at .NET 11. |
Suppressed comments (2)
src/tests/SOS.Tests/PrintExceptionTests.cs:26
- Same issue here: DumpKind.All introduces heap-less Mini dumps, but this test later asserts exact exception message/source lines which likely require heap data. Restrict the matrix to Heap dumps to avoid Mini rows that can't satisfy the oracle.
public static TheoryData<TestConfig> NoInnerMatrix { get; } =
TestMatrices.CurrentThreadCommands(
[TargetCatalog.DivZero, TargetCatalog.SimpleThrow],
Liveness.AllValid,
DumpKind.All);
src/tests/SOS.Tests/PrintExceptionTests.cs:32
- DumpKind.All includes Mini dumps; the reflection inner-exception/message assertions are unlikely to be reliable without managed heap memory. Consider using Heap dumps for this matrix.
public static TheoryData<TestConfig> ReflectionMatrix { get; } =
TestMatrices.CurrentThreadCommands(
[TargetCatalog.Reflection],
Liveness.AllValid,
DumpKind.All);
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| public static TheoryData<TestConfig> ClrmaExceptionMatrix => | ||
| TestConfig.BuildMatrix([TargetCatalog.NestedException], Flavor.AllValid, Host.DotnetDump, dumpKind: DumpKind.All); |
| public static TheoryData<TestConfig> NestedMatrix { get; } = | ||
| TestMatrices.CurrentThreadCommands( | ||
| [TargetCatalog.NestedException], | ||
| Liveness.AllValid, | ||
| DumpKind.All); |
3d5196f to
89a5d09
Compare
89a5d09 to
237278a
Compare
237278a to
67dcd35
Compare
67dcd35 to
e4c0d90
Compare
d044a7e to
c9b9ceb
Compare
c9b9ceb to
ceae004
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
ceae004 to
54cb693
Compare
54cb693 to
1bc52eb
Compare
|
|
1bc52eb to
0574248
Compare
Carry the reviewed command tests and cross-platform capability filters onto the stabilized harness layer. Retire the three fully superseded legacy exception scripts while retaining Reflection coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 72ff9a52-4eb6-46f7-a3f9-39b5f99de529
0574248 to
37073d7
Compare
|
@max-charlamb Addressed in |

Summary
Layer 3 of the native SOS test stack. Depends on #6000.
ObjectReferenceoracle fornotreachableinrangeDivZero.script,NestedExceptionTest.script, andSimpleThrow.scriptafter replacing their exact exception, source-line, stack, thread, live/dump, breakpoint, and CLRMA assertionsReflection.scriptbecause reflection-boundary and target-invocation behavior remains specialized legacy coveragePreservation and split
DumpGen_ArgumentsAndFilterstest andFirstObjectOfExactTypeAssert.NotEmptyguardREADME.mdarchitecture/usage documentation andCOVERAGE.md, updating both surgicallyValidation
./build.sh -configuration Debug -architecture arm64 -rebuild -skipnativenotreachableinrangetest on macOS arm64