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

Add RiscV64 #4838

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microsoft.TestPlatform.ObjectModel/Architecture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public enum Architecture
AnyCPU,
ARM64,
S390x,
Ppc64le
Ppc64le,
RiscV64,
}
Original file line number Diff line number Diff line change
Expand Up @@ -971,3 +971,4 @@ virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.Properties.ge
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.ProtectedGetPropertyValue(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProperty! property, object? defaultValue) -> object?
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.ProtectedSetPropertyValue(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProperty! property, object? value) -> void
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.ValidateValueCallback.Invoke(object? value) -> bool
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.RiscV64 = 8 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public enum PlatformArchitecture
ARM64,
S390x,
Ppc64le,
RiscV64,
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,4 @@ static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ErrorOnI
static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions.GetAssemblyLocation(this System.Reflection.Assembly! assembly) -> string!
virtual Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler.Invoke(object? sender, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs? args) -> System.Reflection.Assembly?
virtual Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.RiscV64 = 6 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public PlatformArchitecture Architecture
// case System.Runtime.InteropServices.Architecture.S390x:
(Architecture)5 => PlatformArchitecture.S390x,
(Architecture)8 => PlatformArchitecture.Ppc64le,
(Architecture)9 => PlatformArchitecture.RiscV64,
_ => throw new NotSupportedException(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public PlatformArchitecture GetCurrentProcessArchitecture()
// case System.Runtime.InteropServices.Architecture.S390x:
(Architecture)5 => PlatformArchitecture.S390x,
(Architecture)8 => PlatformArchitecture.Ppc64le,
(Architecture)9 => PlatformArchitecture.RiscV64,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't recall but maybe worth it check what we do during the selection of the host for this architecture.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do some fallbacks, I cannot really test it since I don't have hardware, but if it is working on s390x or ppc64le it should work for this architecture as well. The rest of the platform special cases x86, x64 and arm64 (e.g. in blame), but not the other ones. So the change here is pretty much the same as what we did for S390x and Ppc64le.

_ => throw new NotSupportedException(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ private static string GetTestHostName(Architecture architecture, Framework targe
PlatformArchitecture.ARM64 => Architecture.ARM64,
PlatformArchitecture.S390x => Architecture.S390x,
PlatformArchitecture.Ppc64le => Architecture.Ppc64le,
PlatformArchitecture.RiscV64 => Architecture.RiscV64,
_ => throw new NotSupportedException(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ PlatformArchitecture TranslateToPlatformArchitecture(Architecture targetArchitec
return PlatformArchitecture.S390x;
case Architecture.Ppc64le:
return PlatformArchitecture.Ppc64le;
case Architecture.RiscV64:
return PlatformArchitecture.RiscV64;
case Architecture.AnyCPU:
case Architecture.Default:
default:
Expand All @@ -566,6 +568,7 @@ static bool IsSameArchitecture(Architecture targetArchitecture, PlatformArchitec
Architecture.ARM64 => platformAchitecture == PlatformArchitecture.ARM64,
Architecture.S390x => platformAchitecture == PlatformArchitecture.S390x,
Architecture.Ppc64le => platformAchitecture == PlatformArchitecture.Ppc64le,
Architecture.RiscV64 => platformAchitecture == PlatformArchitecture.RiscV64,
_ => throw new TestPlatformException($"Invalid target architecture '{targetArchitecture}'"),
};

Expand Down
2 changes: 2 additions & 0 deletions src/vstest.console/TestPlatformHelpers/TestRequestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,8 @@ static Architecture TranslateToArchitecture(PlatformArchitecture targetArchitect
return Architecture.S390x;
case PlatformArchitecture.Ppc64le:
return Architecture.Ppc64le;
case PlatformArchitecture.RiscV64:
return Architecture.RiscV64;
default:
EqtTrace.Error($"TestRequestManager.TranslateToArchitecture: Unhandled architecture '{targetArchitecture}'.");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void InitializeShouldThrowIfArgumentIsNotAnArchitecture()
{
ExceptionUtilities.ThrowsException<CommandLineException>(
() => _executor.Initialize("foo"),
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le.",
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le, RiscV64.",
"foo");
}

Expand All @@ -94,7 +94,7 @@ public void InitializeShouldThrowIfArgumentIsNotASupportedArchitecture()
{
ExceptionUtilities.ThrowsException<CommandLineException>(
() => _executor.Initialize("AnyCPU"),
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le.",
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le, RiscV64.",
"AnyCPU");
}

Expand Down