-
Notifications
You must be signed in to change notification settings - Fork 344
Adding ARM64 support to the test console #1927
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ public enum Architecture | |
| X86, | ||
| X64, | ||
| ARM, | ||
| AnyCPU | ||
| AnyCPU, | ||
| ARM64 | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,29 @@ public static ObjectModel.Architecture OSArchitecture | |
| { | ||
| get | ||
| { | ||
| #if !NETSTANDARD1_4 | ||
| try | ||
| { | ||
| // use the new IsWow64Process2 to detect ARM64 as well. | ||
| var processHandle = System.Diagnostics.Process.GetCurrentProcess().Handle; | ||
| if (IsWow64Process2(processHandle, out ImageFileMachine pProcessMachinem, out ImageFileMachine pNativeMachine)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I submitted this PR almost a year and a half ago, so honestly I have no clue but probably? 🤷♂️. To be honest, I don't even remember submitting this PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will most likely pick this up, when we get ARM64 hardware. |
||
| { | ||
| switch (pNativeMachine) | ||
| { | ||
| case ImageFileMachine.AMD64: | ||
| case ImageFileMachine.IA64: | ||
| return Architecture.X64; | ||
|
Comment on lines
+39
to
+40
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| case ImageFileMachine.X86: | ||
| return Architecture.X86; | ||
| case ImageFileMachine.ARM: | ||
| return Architecture.ARM; | ||
| case ImageFileMachine.ARM64: | ||
| return Architecture.ARM64; | ||
| } | ||
| } | ||
| } | ||
| catch { } | ||
| #endif | ||
| var arch = new PlatformEnvironment().Architecture; | ||
|
|
||
| switch (arch) | ||
|
|
@@ -34,11 +57,25 @@ public static ObjectModel.Architecture OSArchitecture | |
| return ObjectModel.Architecture.X64; | ||
| case PlatformArchitecture.X86: | ||
| return ObjectModel.Architecture.X86; | ||
| case PlatformArchitecture.ARM64: | ||
| return ObjectModel.Architecture.ARM64; | ||
| default: | ||
| return ObjectModel.Architecture.ARM; | ||
| } | ||
| } | ||
| } | ||
| #if !NETSTANDARD1_4 | ||
| private enum ImageFileMachine : ushort | ||
| { | ||
| X86 = 0x014c, | ||
| ARM = 0x01c0, | ||
| IA64 = 0x0200, | ||
| AMD64 = 0x8664, | ||
| ARM64 = 0xAA64 | ||
| } | ||
| [System.Runtime.InteropServices.DllImport("kernel32")] | ||
| private static extern bool IsWow64Process2([System.Runtime.InteropServices.In] IntPtr processHandle, [System.Runtime.InteropServices.Out] out ImageFileMachine pProcessMachinem, [System.Runtime.InteropServices.Out] out ImageFileMachine pNativeMachine); | ||
| #endif | ||
|
|
||
| /// <summary> | ||
| /// Gets the settings to be used while creating XmlReader for runsettings. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -516,7 +516,11 @@ private static void VerifyCompatibilityWithOSArchitecture(Architecture architect | |
| { | ||
| var osArchitecture = XmlRunSettingsUtilities.OSArchitecture; | ||
|
|
||
| if (architecture == Architecture.X86 && osArchitecture == Architecture.X64) | ||
| if (architecture == Architecture.X86 && (osArchitecture == Architecture.X64 || osArchitecture == Architecture.ARM64)) | ||
| { | ||
| return; | ||
| } | ||
| if ((architecture == Architecture.ARM || architecture == Architecture.X86) && osArchitecture == Architecture.ARM64) | ||
|
Comment on lines
+519
to
+523
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The combination |
||
| { | ||
| return; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -336,7 +336,7 @@ | |||||||||||||||
| <value>The --ParentProcessId|/ParentProcessId argument requires the process id which is an integer. Specify the process id of the parent process that launched this process.</value> | ||||||||||||||||
| </data> | ||||||||||||||||
| <data name="InvalidPlatformType" xml:space="preserve"> | ||||||||||||||||
| <value>Invalid platform type:{0}. Valid platform types are x86, x64 and Arm.</value> | ||||||||||||||||
| <value>Invalid platform type:{0}. Valid platform types are x86, x64, Arm and Arm64.</value> | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. capitalize ARM and ARM64 in messages?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope! This is the correct capitalization
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use lower case only as in C# compiler usage help. In any case the two lists below should be consistent, and they are not (@nohwnd): vstest/src/Microsoft.TestPlatform.ObjectModel/Architecture.cs Lines 11 to 16 in b999506
|
||||||||||||||||
| </data> | ||||||||||||||||
| <data name="InvalidPortArgument" xml:space="preserve"> | ||||||||||||||||
| <value>The --Port|/Port argument requires the port number which is an integer. Specify the port for socket connection and receiving the event messages.</value> | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this come from the PlatformEnvironment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No due to backwards compat reasons this API normally lies about the OS architecture, so this is the way to do it.