[cDAC] Refactor cDAC test structure: extract reusable harness, organize under tests/#128863
Draft
max-charlamb wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restructures the cDAC test tree by separating reusable test-authoring infrastructure into a dedicated TestInfrastructure library and relocating the unit-test project under tests/UnitTests/, updating solution/build subset wiring accordingly.
Changes:
- Moved the unit test project/files into
src/native/managed/cdac/tests/UnitTests/. - Extracted shared test harness code into
src/native/managed/cdac/tests/TestInfrastructure/as a packable helper library and updated test projects to reference it. - Updated build/solution documentation and subset definitions (
cdac.slnx,eng/Subsets.props,cdac/README.md) to match the new layout.
Reviewed changes
Copilot reviewed 11 out of 88 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/TypeDescTests.cs | Unit tests for RuntimeTypeSystem TypeDesc behaviors in new UnitTests location. |
| src/native/managed/cdac/tests/UnitTests/SyncBlockTests.cs | Unit tests for SyncBlock contract behaviors. |
| src/native/managed/cdac/tests/UnitTests/SignatureTests.cs | Unit tests for vararg signature/cookie behaviors. |
| src/native/managed/cdac/tests/UnitTests/RuntimeInfoTests.cs | Unit tests for RuntimeInfo architecture/OS/version globals. |
| src/native/managed/cdac/tests/UnitTests/ReJITTests.cs | Unit tests for ReJIT contract behavior using mocks/builders. |
| src/native/managed/cdac/tests/UnitTests/PlatformContextTests.cs | Unit tests for per-arch register context helpers. |
| src/native/managed/cdac/tests/UnitTests/ObjectiveCMarshalTests.cs | Unit tests for ObjectiveCMarshal contract behavior. |
| src/native/managed/cdac/tests/UnitTests/NotificationsTests.cs | Unit tests for notification parsing. |
| src/native/managed/cdac/tests/UnitTests/LoaderHeapTests.cs | Unit tests for LoaderHeap traversal/data. |
| src/native/managed/cdac/tests/UnitTests/GetRegisterNameTests.cs | Unit tests for SOSDac register name mapping logic. |
| src/native/managed/cdac/tests/UnitTests/ExecutionManager/RuntimeFunctionTests.cs | Unit tests for runtime function lookup/length computation. |
| src/native/managed/cdac/tests/UnitTests/ExecutionManager/RangeSectionMapTests.cs | Unit tests for range section map lookup/indexing. |
| src/native/managed/cdac/tests/UnitTests/ExecutionManager/NibbleMapTests.cs | Unit tests for nibble map helpers and lookup variants. |
| src/native/managed/cdac/tests/UnitTests/ExecutionManager/HotColdLookupTests.cs | Unit tests for hot/cold lookup mapping behavior. |
| src/native/managed/cdac/tests/UnitTests/ExecutionManager/HashMapTests.cs | Unit tests for hashmap/ptr-hashmap lookup behavior. |
| src/native/managed/cdac/tests/UnitTests/EnumMethodDefinitionsTests.cs | Unit tests for method enumeration logic over synthetic metadata. |
| src/native/managed/cdac/tests/UnitTests/DacStreamsTests.cs | Unit tests for dac stream decoding behaviors. |
| src/native/managed/cdac/tests/UnitTests/ContractDescriptor/TargetTests.SubDescriptors.cs | Unit tests for contract descriptor sub-descriptor handling. |
| src/native/managed/cdac/tests/UnitTests/ClrDataTaskTests.cs | Unit tests for ClrDataTask current app domain behavior. |
| src/native/managed/cdac/tests/UnitTests/AuxiliarySymbolsTests.cs | Unit tests for auxiliary symbol name lookup behavior. |
| src/native/managed/cdac/tests/UnitTests/Microsoft.Diagnostics.DataContractReader.Tests.csproj | Unit test project moved under UnitTests and updated to reference TestInfrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/TestPlaceholderTarget.cs | Test harness target implementation updated (incl. ctor nullability annotation change). |
| src/native/managed/cdac/tests/TestInfrastructure/TestHelpers.cs | New shared HResult formatting/assertion helper for tests. |
| src/native/managed/cdac/tests/TestInfrastructure/TestConfiguration.cs | Moved dump test configuration type into shared infrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/TargetTestHelpers.cs | Shared test helpers for layout + endian-aware reads/writes. |
| src/native/managed/cdac/tests/TestInfrastructure/SkipOnVersionAttribute.cs | Moved dump-test skip attribute into shared infrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/SkipOnOSAttribute.cs | Moved dump-test skip attribute into shared infrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/SkipOnArchAttribute.cs | Moved dump-test skip attribute into shared infrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/README.md | Documentation for the new TestInfrastructure library package. |
| src/native/managed/cdac/tests/TestInfrastructure/MockTarget.cs | Shared mock target architecture enumeration support. |
| src/native/managed/cdac/tests/TestInfrastructure/MockMemorySpace.cs | Shared mock memory space implementation. |
| src/native/managed/cdac/tests/TestInfrastructure/MockMemorySpace.BumpAllocator.cs | Shared allocator for heap fragments (contains an allocation-size issue; see review comment). |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/TypedView.cs | Shared typed view base for mock descriptor structures. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/MockDescriptors.SyncBlock.cs | Shared sync block mock descriptors/builders. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/MockDescriptors.RuntimeFunctions.cs | Shared runtime function/unwind mock descriptors/builders. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/MockDescriptors.ReJIT.cs | Shared ReJIT mock descriptors/builders. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/MockDescriptors.HashMap.cs | Shared hash map mock descriptors/builders. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/MockDescriptors.Frame.cs | Shared frame mock descriptors/builders. |
| src/native/managed/cdac/tests/TestInfrastructure/MockDescriptors/Layout.cs | Shared layout builders used by mock descriptors. |
| src/native/managed/cdac/tests/TestInfrastructure/ExecutionManager/NibbleMapTestBuilder.cs | Shared nibble map test builder moved into infrastructure. |
| src/native/managed/cdac/tests/TestInfrastructure/DumpTestHelpers.cs | Shared dump test helper utilities. |
| src/native/managed/cdac/tests/TestInfrastructure/DumpInfo.cs | Shared dump-info model + serialization helpers. |
| src/native/managed/cdac/tests/TestInfrastructure/ContractDescriptor/ContractDescriptorHelpers.cs | Shared helpers for constructing contract descriptors in tests. |
| src/native/managed/cdac/tests/TestInfrastructure/ContractDescriptor/ContractDescriptorBuilder.cs | Shared builder for synthetic contract descriptors/targets. |
| src/native/managed/cdac/tests/TestInfrastructure/ClrMdDumpHost.cs | Shared ClrMD-based dump host implementation. |
| src/native/managed/cdac/tests/TestInfrastructure/Microsoft.Diagnostics.DataContractReader.TestInfrastructure.csproj | New reusable harness library project (packable) with references/dependencies. |
| src/native/managed/cdac/tests/DumpTests/Microsoft.Diagnostics.DataContractReader.DumpTests.csproj | Updated dump tests project to reference TestInfrastructure and drop redundant package refs/linking. |
| src/native/managed/cdac/tests/Microsoft.Diagnostics.DataContractReader.Tests.csproj | Removed old unit test csproj at the former location. |
| src/native/managed/cdac/README.md | Updated documentation to point at new UnitTests project path. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Microsoft.Diagnostics.DataContractReader.Legacy.csproj | Added InternalsVisibleTo for TestInfrastructure. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Microsoft.Diagnostics.DataContractReader.Contracts.csproj | Added InternalsVisibleTo for TestInfrastructure. |
| src/native/managed/cdac/cdac.slnx | Updated solution to include TestInfrastructure + UnitTests projects in tests folder. |
| eng/Subsets.props | Updated tools.cdac/tools.cdactests subset project lists for new project structure. |
…r tests/ Reorganize the cdac test layout so the in-repo unit tests and the reusable test-authoring infrastructure are clearly separated and discoverable. Changes: * Move the unit-test project from tests/ into tests/UnitTests/ to match the existing tests/DumpTests/ convention. Sibling tests/StressTests/ and tests/DataGenerator/ already follow this pattern. * Extract the test-harness building blocks (mock-memory infrastructure, MockDescriptors, ContractDescriptorBuilder, ClrMD-based dump host, DumpTestBase + Skip* attributes, etc.) into a new library project tests/TestInfrastructure/Microsoft.Diagnostics.DataContractReader.TestInfrastructure.csproj. This is a library (not a test project), so consumers can write their own xUnit test projects that ProjectReference the harness without picking up IsTestProject semantics or transitive xunit.runner dependencies. The package is added to the tools.cdac packing subset and ships as a transport NuGet alongside the other cdac transport packages. The in-repo Tests and DumpTests projects now ProjectReference TestInfrastructure instead of carrying the harness sources directly. Internals are exposed via InternalsVisibleTo so existing tests don't require any source changes. * Update cdac.slnx, eng/Subsets.props, and src/native/managed/cdac/README.md for the new paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6b0e1d8 to
d4b5c7e
Compare
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR description was drafted with assistance from GitHub Copilot.
Reorganize the cDAC test layout so the in-repo unit tests and the reusable test-authoring infrastructure are clearly separated and discoverable.
Changes
Move unit-test project under
tests/UnitTests/The unit-test project lived directly at
src/native/managed/cdac/tests/while its sibling test projects (DumpTests,StressTests,DataGenerator) all use their own subfolder. This PR moves the unit tests intotests/UnitTests/to match that convention, sotests/becomes a clean parent of per-project subfolders.Extract reusable test-harness into
tests/TestInfrastructure/The cDAC test projects contain a non-trivial body of reusable test-authoring building blocks:
MockMemorySpaceandMockTargetinfrastructureMockDescriptorsfor synthesizing per-contract data layoutsContractDescriptorBuilder/ContractDescriptorHelpersClrMdDumpHost,DumpTestBase,DumpTestStackWalker,DumpInfo,TestConfigurationSkipOnArchAttribute/SkipOnOSAttribute/SkipOnVersionAttributeTestHelpers/TargetTestHelpers/TestPlaceholderTargetNibbleMapTestBuilderThese previously lived inside the
TestsandDumpTestsprojects (with some files cross-linked viaCompile Include). This PR factors them into a new library project:src/native/managed/cdac/tests/TestInfrastructure/Microsoft.Diagnostics.DataContractReader.TestInfrastructure.csprojIt's a library, not a test project, so:
ProjectReferenceit without inheritingIsTestProjectsemantics or transitive xunit runner dependenciestools.cdacpacking subset ineng/Subsets.props)InternalsVisibleToso no test source had to changeThe in-repo
TestsandDumpTestsprojects nowProjectReferenceTestInfrastructureinstead of carrying these sources directly, which also letsDumpTestsdrop redundant transitivePackageReferences onMicrosoft.Diagnostics.RuntimeandMicrosoft.DotNet.XUnitExtensions.Final layout
Verification
TestInfrastructure,Tests, andDumpTestsall build clean (0 errors, 0 warnings)dotnet packonTestInfrastructureproduces a clean nupkg inartifacts/packages/Release/NonShipping/Notes for reviewers
The bulk of the diff is
git mvrenames — theTests.csproj,DumpTests.csproj,TestInfrastructure.csproj,cdac.slnx,eng/Subsets.props, and the two cDACContracts/Legacycsprojs (addedInternalsVisibleTofor the new assembly) are the only material edits.The new
TestInfrastructure.csprojcarries a<NoWarn>list and<Nullable>disable</Nullable>. This matches the relaxed analyzer rules the original test projects ran with — the moved files are unchanged in content, so suppressing the same rules avoids churning unrelated style fixes into this PR.