Disable serial ports tests on Windows Nano (dotnet/corefx#29793)
authorPaulo Janotti <pauloja@microsoft.com>
Sat, 19 May 2018 04:31:31 +0000 (21:31 -0700)
committerGitHub <noreply@github.com>
Sat, 19 May 2018 04:31:31 +0000 (21:31 -0700)
Fix dotnet/corefx#29756

Commit migrated from https://github.com/dotnet/corefx/commit/70959b289ae72f04ad36853cf17c7262fda4ef6b

src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs
src/libraries/System.IO.Ports/tests/Support/TCSupport.cs

index 7439ec0..d46ac8d 100644 (file)
@@ -19,7 +19,7 @@ namespace System.IO.Ports.Tests
         /// <summary>
         /// Check that all ports either open correctly or fail with UnauthorizedAccessException (which implies they're already open)
         /// </summary>
-        [Fact]
+        [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
         private void OpenEveryPortName()
         {
             foreach (string portName in SerialPort.GetPortNames())
@@ -40,7 +40,7 @@ namespace System.IO.Ports.Tests
         /// Test that SerialPort.GetPortNames finds every port that the test helpers have found. 
         /// (On Windows, the latter uses a different technique to SerialPort to find ports).
         /// </summary>
-        [Fact]
+        [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
         private void AllHelperPortsAreInGetPortNames()
         {
             string[] serialPortNames = SerialPort.GetPortNames();
@@ -55,7 +55,7 @@ namespace System.IO.Ports.Tests
         /// Test that the test helpers have found every port that SerialPort.GetPortNames has found
         /// This catches regressions in the test helpers, eg GH #18928 / #20668
         /// </summary>
-        [Fact]
+        [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
         private void AllGetPortNamesAreInHelperPorts()
         {
             string[] helperPortNames = PortHelper.GetPorts();
index ce3448c..43b4c9b 100644 (file)
@@ -32,6 +32,12 @@ namespace Legacy.Support
 
         private static void InitializeSerialInfo()
         {
+            if (PlatformDetection.IsWindowsNanoServer)
+            {
+                s_localMachineSerialPortRequirements = SerialPortRequirements.None;
+                return;
+            }
+
             GenerateSerialInfo();
 
             if (s_localMachineSerialInfo.LoopbackPortName != null)