Skip to content

Commit

Permalink
Add RiscV64 (#4838)
Browse files Browse the repository at this point in the history
* Add RiscV64

* Fix tests
  • Loading branch information
nohwnd authored Jan 19, 2024
1 parent eed4009 commit 53df73d
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 3 deletions.
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,
_ => 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

0 comments on commit 53df73d

Please sign in to comment.