Skip to content

Stabilize and migrate SOS harness coverage - #6001

Open
steveisok wants to merge 1 commit into
steveisok-sos-harness-stabilization-layerfrom
steveisok-sos-coverage-migration
Open

Stabilize and migrate SOS harness coverage#6001
steveisok wants to merge 1 commit into
steveisok-sos-harness-stabilization-layerfrom
steveisok-sos-coverage-migration

Conversation

@steveisok

Copy link
Copy Markdown
Member

Summary

Layer 3 of the native SOS test stack. Depends on #6000.

  • migrates the reviewed command-focused coverage and parsing tests onto the stabilized harness
  • adds explicit command capability filters and cross-platform corrections without Helix or shard plumbing
  • enables .NET 11 SingleFile+cDAC configurations while retaining the layer-2 validity rules
  • adds the ObjectReference oracle for notreachableinrange
  • retires DivZero.script, NestedExceptionTest.script, and SimpleThrow.script after replacing their exact exception, source-line, stack, thread, live/dump, breakpoint, and CLRMA assertions
  • retains Reflection.script because reflection-boundary and target-invocation behavior remains specialized legacy coverage

Preservation and split

  • preserves the newer DumpGen_ArgumentsAndFilters test and FirstObjectOfExactType Assert.NotEmpty guard
  • preserves concurrent stdout/stderr drainage and all layer-2 harness/process/path/capture work
  • keeps README.md architecture/usage documentation and COVERAGE.md, updating both surgically
  • excludes CI, Helix, payload, shard, Arcade, project-local skip, replay attribute, and generated solution changes

Validation

  • ./build.sh -configuration Debug -architecture arm64 -rebuild -skipnative
  • 25 parsing/capability/validity tests
  • 7 focused LLDB live exception and source-stack tests on macOS arm64
  • 1 focused dotnet-dump notreachableinrange test on macOS arm64

@steveisok
steveisok requested a review from a team as a code owner September 2, 2026 23:52
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 0a60d3a to a92c1df Compare September 3, 2026 12:24
Copilot AI lite review requested due to automatic review settings September 4, 2026 02:05
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from a92c1df to b93dcf9 Compare September 4, 2026 02:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​tests/​SOS.Tests/​DiagnosticCommandTests.cs — Clrma_ReportsCurrentExceptionChain asserts the current exception chain, which likely depends on…
Medium severity 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, and NestedExceptionTest script entry points and replaces their coverage with focused SOS.Tests scenarios 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., clru offsets parsing, gcinfo legacy 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.

Comment on lines +24 to +25
public static TheoryData<TestConfig> ClrmaExceptionMatrix =>
TestConfig.BuildMatrix([TargetCatalog.NestedException], Flavor.AllValid, Host.DotnetDump, dumpKind: DumpKind.All);
Comment on lines +16 to +20
public static TheoryData<TestConfig> NestedMatrix { get; } =
TestMatrices.CurrentThreadCommands(
[TargetCatalog.NestedException],
Liveness.AllValid,
DumpKind.All);
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch 2 times, most recently from 3d5196f to 89a5d09 Compare September 4, 2026 12:40
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 89a5d09 to 237278a Compare September 4, 2026 13:07
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 237278a to 67dcd35 Compare September 4, 2026 18:04
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 67dcd35 to e4c0d90 Compare September 4, 2026 19:03
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch 3 times, most recently from d044a7e to c9b9ceb Compare September 4, 2026 20:21
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from c9b9ceb to ceae004 Compare September 4, 2026 21:20
steveisok added a commit that referenced this pull request Sep 4, 2026
## 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
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from ceae004 to 54cb693 Compare September 4, 2026 23:11
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 54cb693 to 1bc52eb Compare September 7, 2026 14:42
@max-charlamb

Copy link
Copy Markdown
Member

SkipUnavailableMacOsDotnetDumpThreads(config) shouldn't be required after #6014 merges

@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 1bc52eb to 0574248 Compare September 8, 2026 23:59
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
@steveisok
steveisok force-pushed the steveisok-sos-coverage-migration branch from 0574248 to 37073d7 Compare September 9, 2026 00:05
@steveisok

Copy link
Copy Markdown
Member Author

@max-charlamb Addressed in 37073d78: #6001 now drops SkipUnavailableMacOsDotnetDumpThreads and all 17 issue-5987-only call sites, while retaining the unrelated issue #5985 skips. I validated the layer against main with #6014/ClrMD 4.1.745803: the SOS.Tests build and 27 parsing/capability/validity tests passed, along with the focused macOS arm64 dotnet-dump smoke (PrintException_NoInnerException, 2/2 configurations).

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.

3 participants