Skip to content

Switch Unix builds to Roslyn.slnx and drive test platform selection via TFM#82989

Merged
jaredpar merged 27 commits intomainfrom
copilot/update-unix-testing-logic
Apr 1, 2026
Merged

Switch Unix builds to Roslyn.slnx and drive test platform selection via TFM#82989
jaredpar merged 27 commits intomainfrom
copilot/update-unix-testing-logic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

This change reworks how our infra decides which tests run on which platform. Previously we just ran any test project in Compilers.slnf on Unix. That meant though to increase the test projects we run on Unix we need to keep expanding Compilers.slnf which is not what that filter is for. After discussion we've decided to go the following route:

  • Unix jobs build Roslyn.slnx. This matches our Windows behavior and ensures we keep a clean build experience for our primary solution on both platforms.
  • Any test project with a simple .NET Core TFM (net9.0, net10.0, etc ...) will run on every platform. If you want a test project to only run on windows then use a platform specific TFM like net10.0-windows.

This job doesn't actually change what tests run on Unix, it's just taking our current state and moving to the new mechanism. A future change will start increasing our Unix test coverage.

After some offline discussion decided to just go ahead and enable test projects that can run on Unix without any changes as part of this PR. Have now done so. The result of the script to decide which did / didn't run without changes is

https://gist.github.com/jaredpar/6fbf7d90e92f9d37a4fdee75a51c75ad

…n Compilers.slnf

Agent-Logs-Url: https://github.com/dotnet/roslyn/sessions/92a99a58-ee03-4cc9-b98d-b2959e899567

Co-authored-by: jaredpar <146967+jaredpar@users.noreply.github.com>
…ests rehydrate step

Agent-Logs-Url: https://github.com/dotnet/roslyn/sessions/ddc03428-c1ba-416d-a46b-080360a74d5d

Co-authored-by: jaredpar <146967+jaredpar@users.noreply.github.com>
@jaredpar jaredpar marked this pull request as ready for review March 31, 2026 16:53
@jaredpar jaredpar requested review from a team as code owners March 31, 2026 16:53
@jaredpar
Copy link
Copy Markdown
Member

@333fred, @dibarbet, @dotnet/roslyn-infrastructure PTAL

@RikkiGibson
Copy link
Copy Markdown
Member

Def think it will be good to be able to take this and then perhaps even start enabling tests on a project-by-project basis

@jaredpar
Copy link
Copy Markdown
Member

Def think it will be good to be able to take this and then perhaps even start enabling tests on a project-by-project basis

That is my plan. I have follow up PRs that do this. But I wanted to have a single change where keep the tests executed the same, just get us into the new approach

Copy link
Copy Markdown
Member

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

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

Done review pass, I'd like to also compare the PR CI "before-and-after" when it is available

<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.Test.Utilities</RootNamespace>
<TargetFrameworks>$(NetRoslynAll);net472</TargetFrameworks>
<TargetFrameworks>$(NetRoslynWindows);net472</TargetFrameworks>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It feels like projects which don't contain tests, such as these .Utilities projects, shouldn't need to move to a windows-specific TFM.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot revert the changes to all the utilities projects.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted all IsTestUtilityProject projects back to their original cross-platform TFMs ($(NetRoslynAll);net472 or $(NetRoslyn)) in 6c9ecac. Test consumers handle platform selection via their own TFMs.

return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
}

if (tfmDirName.EndsWith("-linux", StringComparison.Ordinal))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That is one I didn't check because I thought for sure -linux was real. I agree it's not in that list but feels odd there is a -android but not -linux. @baronfel?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't have a linux-specific surface area/framework, which is what drives the need most of these TFM-based suffixes. The entire feature mostly exists to trigger other extensibility mechanisms like workloads or FrameworkReferences.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot remove the -linux check as it's not a real TFM.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the -linux check in 8851528.

Copy link
Copy Markdown
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Feels like the blast radius of this is too large. I agree with the principles, but some of these test exclusions seem wrong to me.

<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities</RootNamespace>
<TargetFrameworks>$(NetRoslynAll);net472</TargetFrameworks>
<TargetFrameworks>$(NetRoslynWindows);net472</TargetFrameworks>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly here, thos doesn't seem like it needs to move.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This job is trying to move us to the new way of deciding which tests run without actually changing what is running. This test didn't previously run on Linux hence moved to keep it not running on Linux. My later PR is going to come back and move the ones that can run on Linux over.

At first I tried to do this all in one PR, the review got big, decided to piece meal it.

<PropertyGroup>
<StartupObject />
<TargetFrameworks>$(NetRoslynAll);net472</TargetFrameworks>
<TargetFrameworks>$(NetRoslynWindows);net472</TargetFrameworks>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For these tests (CLASP, LanguageServer, Features tests), do we have a tracking issue for making them run on linux? These are absolutely things that should be testable on linux, since they run on linux.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto for the change of the LanguageServer project itself.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetRoslyn)</TargetFramework>
<TargetFramework>$(NetRoslynWindows)</TargetFramework>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What makes this only runnable on Windows?


<PropertyGroup>
<TargetFramework>$(NetRoslyn)</TargetFramework>
<TargetFramework>$(NetRoslynWindows)</TargetFramework>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What makes this only runnable on Windows?

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetRoslyn)</TargetFramework>
<TargetFramework>$(NetRoslynWindows)</TargetFramework>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm pretty sure I ran these tests on Linux just a couple weeks ago.

…ject TFMs to cross-platform

Agent-Logs-Url: https://github.com/dotnet/roslyn/sessions/66ff5f30-bc9a-474e-aaff-bd0500c36307

Co-authored-by: jaredpar <146967+jaredpar@users.noreply.github.com>
jaredpar and others added 6 commits March 31, 2026 20:40
… NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…o NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Only real concern with this is a lot of tests projects are being marked windows only that I really would expect is already working. Frankly I'd rather review the big PR with a bunch of other changes than this where there's a bunch of head scratching. If it's easy enough to ask Copilot to either either:

  1. Convert projects back where the tests already 100% pass, or
  2. Add a comment to say at least one of the test that are failing and why.

Doesn't have to be a great explanation, but at least there's a bit of a pointer to why it has to stay that way.

# This is a temporary step until the actual test run moves to helix (then we would need to rehydrate the tests there instead)
- task: BatchScript@1
displayName: Rehydrate Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (net10.0)
displayName: Rehydrate Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (net10.0-windows)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should run just fine on Linux/Mac. If this was a change you made just because it's in the Windows queue consider a revert, otherwise add this to your list to invesetigate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

<PropertyGroup>
<StartupObject />
<TargetFrameworks>$(NetRoslynAll);net472</TargetFrameworks>
<TargetFrameworks>$(NetRoslynWindows);net472</TargetFrameworks>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto for the change of the LanguageServer project itself.

return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
}

if (tfmDirName.EndsWith("-macos", StringComparison.Ordinal))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have any of these? Or just being complete?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just being complete.

jaredpar and others added 6 commits March 31, 2026 21:16
…NetRoslynWindows to NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…etRoslynWindows to NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…slynWindows to NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nWindows to NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oslynWindows to NetRoslyn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoeRobich
Copy link
Copy Markdown
Member

@jaredpar I think you will need this change as well f118c9f for the tests to run in CI

jaredpar and others added 3 commits March 31, 2026 18:41
Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com>
@jaredpar jaredpar requested a review from a team as a code owner April 1, 2026 05:42
@jaredpar jaredpar merged commit f839a71 into main Apr 1, 2026
28 checks passed
@jaredpar jaredpar deleted the copilot/update-unix-testing-logic branch April 1, 2026 07:16
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants