Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to build/run tests on linux-arm64 #74536

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

omajid
Copy link
Member

@omajid omajid commented Jul 24, 2024

I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like:

Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1
Could not find 'dotnet' host for the 'X64' architecture.

You can resolve the problem by installing the 'X64' .NET.

With the changes in this commit, I can build and run all tests using:

$ ./eng/build.sh --restore --build --pack
$ ./eng/build.sh --test

I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like #74392 earlier.

One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.

@omajid omajid requested review from a team as code owners July 24, 2024 14:09
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 24, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Jul 24, 2024
@omajid omajid force-pushed the build-run-tests-arm64 branch 3 times, most recently from b39f092 to e861af5 Compare July 24, 2024 22:33
@333fred
Copy link
Member

333fred commented Jul 25, 2024

@jaredpar for a second review.

System.Runtime.InteropServices.Architecture.Wasm => "wasm",
System.Runtime.InteropServices.Architecture.X86 => "x86",
System.Runtime.InteropServices.Architecture.X64 => "x64",
_ => throw new NotImplementedException()
Copy link
Member

Choose a reason for hiding this comment

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

This rough code path being copied three times bothers me a bit. Trying to think of a way to reduce it.

This copy should be able to reference the one in ILAsmUtilities.cs. Or at least we should be able to put it in one location in that project and reference it here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it bothered me as well. My only thought had been putting it in a separate file and source-including it in each place, and I wasn't sure that was actually better.

Copy link
Member

Choose a reason for hiding this comment

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

I think we could simplify this whole method to RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant().

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

System.Runtime.InteropServices.Architecture.Ppc64le => "ppc64le",
System.Runtime.InteropServices.Architecture.S390x => "s390x",
System.Runtime.InteropServices.Architecture.Wasm => "wasm",
System.Runtime.InteropServices.Architecture.X86 => "x86",
Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about this a bit: do we want to handle x86 at all? IIRC there have been some problems in the past where this forced x86 in VisualStudio, even on x64 machines.

Copy link
Member

Choose a reason for hiding this comment

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

I would keep it there for completeness but this is only called on Linux paths and I don't think we really test x86 linux to my knowldege.

I wanted to run the roslyn test suite on Linux on arm64. Building
everything worked, but running tests would fail with errors like:

    Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1
    Could not find 'dotnet' host for the 'X64' architecture.

    You can resolve the problem by installing the 'X64' .NET.

With the changes in this commit, I can build and run all tests using:

    $ ./eng/build.sh --restore --build --pack
    $ ./eng/build.sh --test

I would, eventually, like to be able to run the tests on other
platforms, including s390x and ppc64le. Hopefully that might help
identify/fix issues like dotnet#74392
earlier.

One thing I am not too happy about in this change is how many places
need an explicit addition of "linux-arm64". That won't scale as we want
to add more architectures.
Copy link
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.

@omajid, in the future please avoid force-pushing to PRs that are in-review. It prevents using a simple diff between the previously-reviewed commit and the current code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants