Skip to content

Commit 53df73d

Browse files
authored
Add RiscV64 (#4838)
* Add RiscV64 * Fix tests
1 parent eed4009 commit 53df73d

File tree

10 files changed

+15
-3
lines changed

10 files changed

+15
-3
lines changed

src/Microsoft.TestPlatform.ObjectModel/Architecture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public enum Architecture
1212
AnyCPU,
1313
ARM64,
1414
S390x,
15-
Ppc64le
15+
Ppc64le,
16+
RiscV64,
1617
}

src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,3 +971,4 @@ virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.Properties.ge
971971
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.ProtectedGetPropertyValue(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProperty! property, object? defaultValue) -> object?
972972
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.ProtectedSetPropertyValue(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProperty! property, object? value) -> void
973973
virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.ValidateValueCallback.Invoke(object? value) -> bool
974+
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.RiscV64 = 8 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture

src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformArchitecture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ public enum PlatformArchitecture
1414
ARM64,
1515
S390x,
1616
Ppc64le,
17+
RiscV64,
1718
}

src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,4 @@ static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ErrorOnI
121121
static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions.GetAssemblyLocation(this System.Reflection.Assembly! assembly) -> string!
122122
virtual Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler.Invoke(object? sender, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs? args) -> System.Reflection.Assembly?
123123
virtual Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void
124+
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.RiscV64 = 6 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture

src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformEnvironment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public PlatformArchitecture Architecture
2929
// case System.Runtime.InteropServices.Architecture.S390x:
3030
(Architecture)5 => PlatformArchitecture.S390x,
3131
(Architecture)8 => PlatformArchitecture.Ppc64le,
32+
(Architecture)9 => PlatformArchitecture.RiscV64,
3233
_ => throw new NotSupportedException(),
3334
};
3435
}

src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public PlatformArchitecture GetCurrentProcessArchitecture()
4242
// case System.Runtime.InteropServices.Architecture.S390x:
4343
(Architecture)5 => PlatformArchitecture.S390x,
4444
(Architecture)8 => PlatformArchitecture.Ppc64le,
45+
(Architecture)9 => PlatformArchitecture.RiscV64,
4546
_ => throw new NotSupportedException(),
4647
};
4748
}

src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ private static string GetTestHostName(Architecture architecture, Framework targe
290290
PlatformArchitecture.ARM64 => Architecture.ARM64,
291291
PlatformArchitecture.S390x => Architecture.S390x,
292292
PlatformArchitecture.Ppc64le => Architecture.Ppc64le,
293+
PlatformArchitecture.RiscV64 => Architecture.RiscV64,
293294
_ => throw new NotSupportedException(),
294295
};
295296

src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ PlatformArchitecture TranslateToPlatformArchitecture(Architecture targetArchitec
548548
return PlatformArchitecture.S390x;
549549
case Architecture.Ppc64le:
550550
return PlatformArchitecture.Ppc64le;
551+
case Architecture.RiscV64:
552+
return PlatformArchitecture.RiscV64;
551553
case Architecture.AnyCPU:
552554
case Architecture.Default:
553555
default:
@@ -566,6 +568,7 @@ static bool IsSameArchitecture(Architecture targetArchitecture, PlatformArchitec
566568
Architecture.ARM64 => platformAchitecture == PlatformArchitecture.ARM64,
567569
Architecture.S390x => platformAchitecture == PlatformArchitecture.S390x,
568570
Architecture.Ppc64le => platformAchitecture == PlatformArchitecture.Ppc64le,
571+
Architecture.RiscV64 => platformAchitecture == PlatformArchitecture.RiscV64,
569572
_ => throw new TestPlatformException($"Invalid target architecture '{targetArchitecture}'"),
570573
};
571574

src/vstest.console/TestPlatformHelpers/TestRequestManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ static Architecture TranslateToArchitecture(PlatformArchitecture targetArchitect
848848
return Architecture.S390x;
849849
case PlatformArchitecture.Ppc64le:
850850
return Architecture.Ppc64le;
851+
case PlatformArchitecture.RiscV64:
852+
return Architecture.RiscV64;
851853
default:
852854
EqtTrace.Error($"TestRequestManager.TranslateToArchitecture: Unhandled architecture '{targetArchitecture}'.");
853855
break;

test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void InitializeShouldThrowIfArgumentIsNotAnArchitecture()
8585
{
8686
ExceptionUtilities.ThrowsException<CommandLineException>(
8787
() => _executor.Initialize("foo"),
88-
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le.",
88+
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le, RiscV64.",
8989
"foo");
9090
}
9191

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

0 commit comments

Comments
 (0)