Skip to content

Conversation

max-charlamb
Copy link
Member

@max-charlamb max-charlamb commented Aug 28, 2025

This pull request reorganizes and improves the project and build configuration, with a particular focus on test infrastructure and project structure. The changes streamline how test projects are referenced and built, clarify property settings for packaging and shipping, and update solution/project references to reflect a new directory structure for test assets.

Project and Build Configuration Improvements:

  • Added a new Build.proj traversal project that includes all main diagnostic tool projects and conditionally includes test projects, improving build orchestration and clarity.
  • Updated Directory.Build.props to set IsShipping and IsPackable to false by default, and suppress warnings about packing non-packable projects, ensuring that internal/test projects are not accidentally shipped or packed.
  • Added architecture-specific properties for test .NET install roots and registry roots, improving test environment configuration for different target architectures.

Test Infrastructure and Project Structure:

  • Added add_subdirectory(tests) to CMakeLists.txt to ensure that test projects are included in native builds.
  • Updated the Visual Studio solution file debuggees.sln to reference test debuggee projects from the new tests/Debuggees directory, and added several new test debuggee projects to the solution.
  • Corrected a path in THIRD-PARTY-NOTICES.TXT to point to the new location of the Xunit.Extensions code under tests/Microsoft.Diagnostics.TestHelpers, reflecting the directory reorganization.edited version of Move tests and test debuggees to repo root 'tests' directory #5469

@max-charlamb max-charlamb marked this pull request as ready for review August 28, 2025 21:46
@max-charlamb max-charlamb requested a review from a team as a code owner August 28, 2025 21:46
@max-charlamb max-charlamb changed the title Prepare tests to run on helix Move tests and test debuggees to repo root 'tests' directory Aug 28, 2025
steveisok
steveisok previously approved these changes Aug 29, 2025
@steveisok steveisok self-requested a review August 29, 2025 22:28
steveisok
steveisok previously approved these changes Aug 29, 2025
Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

What is the rationale for moving stuff in \src\tests -> \tests? For example dotnet\runtime or dotnet\aspnetcore both put their tests under the src directory. It seems like this creates a lot of churn and makes our repo different than others.

I'm not necessarily opposed but I do want to understand before we churn 100s of files in the repo versioning history. I just marked request changes to make sure it doesn't get accidentally checked in before we talked about it.

@steveisok steveisok self-requested a review September 4, 2025 23:42
steveisok
steveisok previously approved these changes Sep 4, 2025
Copy link
Member

@steveisok steveisok left a comment

Choose a reason for hiding this comment

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

I think we're good now.

<Import ConfigFile="Debugger.Tests.Common.txt" />
<DotNetRoot>$(RepoRootDir)/.dotnet-test</DotNetRoot>
<Import ConfigFile="$(DotNetRoot)/Debugger.Tests.Versions.txt" />
<DotNetRoot Condition="'$(TestDotNetRoot)' != ''">$(TestDotNetRoot)</DotNetRoot>
Copy link
Member

Choose a reason for hiding this comment

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

I assume the design intent is that TestDotNetRoot won't be defined when running Helix? Its not yet clear to me why that will be the case, but I'm hoping things will make sense once I've got a better understanding how the Helix run is executed.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's the only thing that can't be relative pathed. When the sdk is sent along, the DOTNET_ROOT env variable is also set. We can just read from the env variable in that case.

Copy link
Member

Choose a reason for hiding this comment

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

From what I see in the logic, DotNetRoot gets set to the env var DOTNET_ROOT before we start parsing the config file. TestDotNetRoot gets set from Debugger.Tests.Common.txt which was generated in the build and points to the '.dotnet-test' folder. If the files were then copied to helix and run with DOTNET_ROOT set it looks like the final result would be ".dotnet-test" which isn't the behavior we want right?

I was expecting this would be something like "<DotNetRoot Condition='$(DotNetRoot)'==''>$(DefaultDotNetRoot) where DefaultDotNetRoot = $(RepoRoot).dotnet-test[\x86]

Copy link
Member

Choose a reason for hiding this comment

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

I'll revert this change as it doesn't really apply until #5560

VisualStudioVersion = 17.12.35309.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDebuggee", "src\SOS\lldbplugin.tests\TestDebuggee\TestDebuggee.csproj", "{6C43BE85-F8C3-4D76-8050-F25CE953A7FD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDebuggee", "src\tests\Debuggees\TestDebuggee\TestDebuggee.csproj", "{6C43BE85-F8C3-4D76-8050-F25CE953A7FD}"
Copy link
Member

Choose a reason for hiding this comment

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

As I understand the reason we are moving all the debuggees around is to facilitate carving up the bin directory into smaller per-test artifacts that can be sent to Helix. I'd propose we start with a simpler model and then observe what performance we are getting before doing further optimization:

  • Package up the entire artifacts/bin into a single bundle (I'm seeing 280MB compressed)
  • We can still choose to send that bundle to multiple machines and run a single test project on each if we want (at least I assume we can do that).
  • That should eliminate the need to move files around, track which projects depend on which assets, or create any complicated bundling logic.

Copy link
Member

Choose a reason for hiding this comment

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

I get what you're after. I'll tweak this to have the artifacts land where they normally would and then we can address in #5560

<DotNetRoot>$(RepoRootDir)/.dotnet-test</DotNetRoot>
<Import ConfigFile="$(DotNetRoot)/Debugger.Tests.Versions.txt" />
<DotNetRoot Condition="'$(TestDotNetRoot)' != ''">$(TestDotNetRoot)</DotNetRoot>
<Import ConfigFile="$(TestVersionConfigDir)/Debugger.Tests.Versions.txt" />
Copy link
Member

Choose a reason for hiding this comment

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

It feels weird that we've got some tests looking for this version file in one place (.dotnet-test) and other tests looking for it in artifacts\bin. Even if it is hard-coded for now, can we get them all pointing to the same place and remove the versions.config.txt being produced in .dotnet-test?

Copy link
Member

Choose a reason for hiding this comment

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

It would be easier to revert this change as it doesn't really apply until #5560.

Copy link
Member

Choose a reason for hiding this comment

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

That works too.

<Import ConfigFile="Debugger.Tests.Common.txt" />
<DotNetRoot>$(RepoRootDir)/.dotnet-test</DotNetRoot>
<Import ConfigFile="$(DotNetRoot)/Debugger.Tests.Versions.txt" />
<DotNetRoot Condition="'$(TestDotNetRoot)' != ''">$(TestDotNetRoot)</DotNetRoot>
Copy link
Member

Choose a reason for hiding this comment

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

From what I see in the logic, DotNetRoot gets set to the env var DOTNET_ROOT before we start parsing the config file. TestDotNetRoot gets set from Debugger.Tests.Common.txt which was generated in the build and points to the '.dotnet-test' folder. If the files were then copied to helix and run with DOTNET_ROOT set it looks like the final result would be ".dotnet-test" which isn't the behavior we want right?

I was expecting this would be something like "<DotNetRoot Condition='$(DotNetRoot)'==''>$(DefaultDotNetRoot) where DefaultDotNetRoot = $(RepoRoot).dotnet-test[\x86]

<FileWrites Include="$(DebuggerVersionConfigFileName)" />
</ItemGroup>
</Target>
</Project>
Copy link
Member

Choose a reason for hiding this comment

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

I wanted to comment on the *.UnitTest renames but GH won't let me add a comment there.

I'd suggest if we rename these projects we should use ".Tests" instead of ".UnitTests". Many of these tests are more accurately described as functional or integration tests rather than unit tests.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.

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.

4 participants