[cDAC] Dumptest Stackwalker Improvements#124912
[cDAC] Dumptest Stackwalker Improvements#124912max-charlamb wants to merge 2 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new DumpTestStackWalker helper class to simplify writing stack frame validation tests in the cDAC dump test suite, and adds three new tests demonstrating its usage.
Changes:
- Adds
DumpTestStackWalkerhelper class with fluent API for asserting stack frame sequences with support for adjacency checking, predicate matching, and flexible inner-to-outer/outer-to-inner traversal - Adds new tests validating expected frame sequences in StackWalk, PInvokeStub, and VarargPInvoke dump tests
- Updates
RunDumpTests.ps1to compute and pass skip versions to the test build, improving test filtering when running subset of versions
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| DumpTestStackWalker.cs | New helper class providing fluent API for stack frame assertions with support for adjacency, predicates, and directional traversal |
| StackWalkDumpTests.cs | Adds test validating the expected frame sequence (MethodC → MethodB → MethodA → Main) using the new helper |
| VarargPInvokeDumpTests.cs | Adds test validating vararg P/Invoke stack frames including ILStub frame detection using predicate matching |
| PInvokeStubDumpTests.cs | Adds test validating P/Invoke stack frames (memcpy → CrashInILStubPInvoke → Main) |
| RunDumpTests.ps1 | Enhances script to compute and pass skipped versions to test build via MSBuild property |
| public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert) | ||
| { | ||
| _name = name; | ||
| _predicate = null; | ||
| _assert = assert; | ||
| this.Adjacent = Adjacent; | ||
| Description = name; | ||
| } | ||
|
|
||
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert) | ||
| { | ||
| _name = null; | ||
| _predicate = predicate; | ||
| _assert = assert; | ||
| this.Adjacent = Adjacent; |
There was a problem hiding this comment.
The parameter name Adjacent should be lowercase adjacent to follow C# naming conventions. Parameter names should use camelCase, not PascalCase.
| public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = name; | |
| _predicate = null; | |
| _assert = assert; | |
| this.Adjacent = Adjacent; | |
| Description = name; | |
| } | |
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = null; | |
| _predicate = predicate; | |
| _assert = assert; | |
| this.Adjacent = Adjacent; | |
| public Expectation(string name, bool adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = name; | |
| _predicate = null; | |
| _assert = assert; | |
| this.Adjacent = adjacent; | |
| Description = name; | |
| } | |
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = null; | |
| _predicate = predicate; | |
| _assert = assert; | |
| this.Adjacent = adjacent; |
| public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert) | ||
| { | ||
| _name = name; | ||
| _predicate = null; | ||
| _assert = assert; | ||
| this.Adjacent = Adjacent; | ||
| Description = name; | ||
| } | ||
|
|
||
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert) | ||
| { | ||
| _name = null; | ||
| _predicate = predicate; | ||
| _assert = assert; | ||
| this.Adjacent = Adjacent; |
There was a problem hiding this comment.
The parameter name Adjacent should be lowercase adjacent to follow C# naming conventions. Parameter names should use camelCase, not PascalCase.
| public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = name; | |
| _predicate = null; | |
| _assert = assert; | |
| this.Adjacent = Adjacent; | |
| Description = name; | |
| } | |
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = null; | |
| _predicate = predicate; | |
| _assert = assert; | |
| this.Adjacent = Adjacent; | |
| public Expectation(string name, bool adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = name; | |
| _predicate = null; | |
| _assert = assert; | |
| this.Adjacent = adjacent; | |
| Description = name; | |
| } | |
| public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool adjacent, Action<ResolvedFrame>? assert) | |
| { | |
| _name = null; | |
| _predicate = predicate; | |
| _assert = assert; | |
| this.Adjacent = adjacent; |
Adds tools to better add stack tests