Skip to content

Commit

Permalink
[rel/17.4] Fix Invalid target architecture 'S390x' error (#4079)
Browse files Browse the repository at this point in the history
Co-authored-by: Giridhar Trivedi <giridhar.trivedi@ibm.com>
Co-authored-by: Giridhar Trivedi <giritrivedi@gmail.com>
Co-authored-by: Sapana-Khemkar <94051076+Sapana-Khemkar@users.noreply.github.com>
  • Loading branch information
4 people committed Oct 19, 2022
1 parent f760ea3 commit c02ece8
Show file tree
Hide file tree
Showing 10 changed files with 18 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 @@ -11,5 +11,6 @@ public enum Architecture
ARM,
AnyCPU,
ARM64,
S390x
S390x,
Ppc64le
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM = 3 -> Microsof
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.Default = 0 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.S390x = 6 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.Ppc64le = 7 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.X64 = 2 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.X86 = 1 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
Microsoft.VisualStudio.TestPlatform.ObjectModel.AttachmentSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ public enum PlatformArchitecture
ARM,
ARM64,
S390x,
Ppc64le,
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.ARM = 2 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.ARM64 = 3 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.S390x = 4 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.Ppc64le = 5 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.X64 = 1 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.X86 = 0 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public PlatformArchitecture Architecture
// preview 6 or later, so use the numerical value for now.
// case System.Runtime.InteropServices.Architecture.S390x:
(Architecture)5 => PlatformArchitecture.S390x,
(Architecture)8 => PlatformArchitecture.Ppc64le,
_ => throw new NotSupportedException(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public PlatformArchitecture GetCurrentProcessArchitecture()
// preview 6 or later, so use the numerical value for now.
// case System.Runtime.InteropServices.Architecture.S390x:
(Architecture)5 => PlatformArchitecture.S390x,
(Architecture)8 => PlatformArchitecture.Ppc64le,
_ => throw new NotSupportedException(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ private static string GetTestHostName(Architecture architecture, Framework targe
PlatformArchitecture.ARM => Architecture.ARM,
PlatformArchitecture.ARM64 => Architecture.ARM64,
PlatformArchitecture.S390x => Architecture.S390x,
PlatformArchitecture.Ppc64le => Architecture.Ppc64le,
_ => throw new NotSupportedException(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ PlatformArchitecture TranslateToPlatformArchitecture(Architecture targetArchitec
return PlatformArchitecture.ARM;
case Architecture.ARM64:
return PlatformArchitecture.ARM64;
case Architecture.S390x:
return PlatformArchitecture.S390x;
case Architecture.Ppc64le:
return PlatformArchitecture.Ppc64le;
case Architecture.AnyCPU:
case Architecture.Default:
default:
Expand All @@ -552,6 +556,8 @@ static bool IsSameArchitecture(Architecture targetArchitecture, PlatformArchitec
Architecture.X64 => platformAchitecture == PlatformArchitecture.X64,
Architecture.ARM => platformAchitecture == PlatformArchitecture.ARM,
Architecture.ARM64 => platformAchitecture == PlatformArchitecture.ARM64,
Architecture.S390x => platformAchitecture == PlatformArchitecture.S390x,
Architecture.Ppc64le => platformAchitecture == PlatformArchitecture.Ppc64le,
_ => 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 @@ -841,6 +841,8 @@ static Architecture TranslateToArchitecture(PlatformArchitecture targetArchitect
return Architecture.ARM64;
case PlatformArchitecture.S390x:
return Architecture.S390x;
case PlatformArchitecture.Ppc64le:
return Architecture.Ppc64le;
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.",
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le.",
"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.",
"Invalid platform type: {0}. Valid platform types are X86, X64, ARM, ARM64, S390x, Ppc64le.",
"AnyCPU");
}

Expand Down

0 comments on commit c02ece8

Please sign in to comment.