diff --git a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs index 98662b34a0675..00b6965c07b8e 100644 --- a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs +++ b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs @@ -191,7 +191,10 @@ internal static bool TryReadStatFile(int pid, out ParsedStat result, ReusableTex internal static bool TryReadStatFile(int pid, int tid, out ParsedStat result, ReusableTextReader reusableReader) { bool b = TryParseStatFile(GetStatFilePathForThread(pid, tid), out result, reusableReader); - Debug.Assert(!b || result.pid == tid, "Expected thread ID from stat file to match supplied tid"); + // + // This assert currently fails in the Windows Subsystem For Linux. See https://github.com/Microsoft/BashOnWindows/issues/967. + // + //Debug.Assert(!b || result.pid == tid, "Expected thread ID from stat file to match supplied tid"); return b; } diff --git a/src/libraries/Common/tests/System/PlatformDetection.cs b/src/libraries/Common/tests/System/PlatformDetection.cs index fcb5d40576be9..e429ca9075379 100644 --- a/src/libraries/Common/tests/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/System/PlatformDetection.cs @@ -23,6 +23,32 @@ public static class PlatformDetection public static int WindowsVersion { get; } = GetWindowsVersion(); + private static Lazy m_isWindowsSubsystemForLinux = new Lazy(GetIsWindowsSubsystemForLinux); + + public static bool IsWindowsSubsystemForLinux => m_isWindowsSubsystemForLinux.Value; + public static bool IsNotWindowsSubsystemForLinux => !IsWindowsSubsystemForLinux; + + private static bool GetIsWindowsSubsystemForLinux() + { + // https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364 + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + const string versionFile = "/proc/version"; + if (File.Exists(versionFile)) + { + var s = File.ReadAllText(versionFile); + + if (s.Contains("Microsoft") || s.Contains("WSL")) + { + return true; + } + } + } + + return false; + } + public static bool IsDebian8 { get; } = IsDistroAndVersion("debian", "8"); public static bool IsUbuntu1510 { get; } = IsDistroAndVersion("ubuntu", "15.10"); public static bool IsUbuntu1604 { get; } = IsDistroAndVersion("ubuntu", "16.04"); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index e97ae03c52991..b9aa7e340508b 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -403,7 +403,7 @@ public void TestProcessorTime() Assert.InRange(processorTimeAtHalfSpin, processorTimeBeforeSpin, Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/974 public void TestProcessStartTime() { TimeSpan allowedWindow = TimeSpan.FromSeconds(3); @@ -417,7 +417,7 @@ public void TestProcessStartTime() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/968 [PlatformSpecific(~PlatformID.OSX)] // getting/setting affinity not supported on OSX public void TestProcessorAffinity() { diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs index bfa819ffb5177..105d934b480c9 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs @@ -77,7 +77,7 @@ public void TestStartTimeProperty_OSX() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/974 [PlatformSpecific(~PlatformID.OSX)] // OSX throws PNSE from StartTime public async Task TestStartTimeProperty() { diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.genclass.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.genclass.cs index 25afc97bc81ef..49fe4c8a8b208 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.genclass.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.genclass.cs @@ -1436,7 +1436,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.genclas public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod()); diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs index 668203e41869c..8f4795d853fbe 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs @@ -1734,7 +1734,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.regclas public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod()); diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs index 8d4f1dc8520e1..f7d9efaa2900e 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs @@ -965,7 +965,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.basic.array public class Program { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod()); diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.returnType.covariant.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.returnType.covariant.cs index acdf8d554ca27..af053a72ced61 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.returnType.covariant.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.returnType.covariant.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using Xunit; namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.returnType.covariant.indexer001.indexer001 @@ -3421,7 +3422,7 @@ public override bool Equals(object o) public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.statements.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.statements.cs index b4b0753ddb2fc..037828ac3b421 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.statements.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.statements.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using Xunit; namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.statements.checked001.checked001 @@ -24,7 +25,7 @@ public int GetMaxInt() public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -81,7 +82,7 @@ public int GetMaxInt public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -124,7 +125,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.statements. public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -168,7 +169,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.statements. public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -212,7 +213,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.statements. public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -491,7 +492,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.statements. public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -1763,7 +1764,7 @@ public int GetMaxInt() public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); @@ -1813,7 +1814,7 @@ public int GetMaxInt() public class Test { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void DynamicCSharpRunTest() { Assert.Equal(0, MainMethod(null)); diff --git a/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj b/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj index 6564f4e198135..17ecc50aad270 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj +++ b/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj @@ -162,6 +162,9 @@ + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs b/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs index 74d03d61a0c75..eee3ed331acf6 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs @@ -59,7 +59,7 @@ public void PropertiesOfInvalidDrive() Assert.Equal(invalidDriveName, invalidDrive.VolumeLabel); // VolumeLabel is equivalent to Name on Unix } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/dotnet/corefx/issues/11570 [PlatformSpecific(PlatformID.AnyUnix)] public void PropertiesOfValidDrive() { diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj b/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj index 8daa88c25f77c..c2615813370e4 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj +++ b/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj @@ -21,6 +21,9 @@ + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Changed.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Changed.cs index 960af3a0fc181..c60a550deb87a 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Changed.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Changed.cs @@ -9,7 +9,7 @@ namespace System.IO.Tests { public class Directory_Changed_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Changed_LastWrite() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -23,7 +23,7 @@ public void FileSystemWatcher_Directory_Changed_LastWrite() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Changed_WatchedFolder() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -36,7 +36,7 @@ public void FileSystemWatcher_Directory_Changed_WatchedFolder() } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [InlineData(false)] [InlineData(true)] public void FileSystemWatcher_Directory_Changed_Nested(bool includeSubdirectories) @@ -58,7 +58,7 @@ public void FileSystemWatcher_Directory_Changed_Nested(bool includeSubdirectorie } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Changed_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Create.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Create.cs index 82d0dd991702c..799829c52de71 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Create.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Create.cs @@ -9,7 +9,7 @@ namespace System.IO.Tests { public class Directory_Create_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Create() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -25,7 +25,7 @@ public void FileSystemWatcher_Directory_Create() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Create_InNestedDirectory() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -44,7 +44,7 @@ public void FileSystemWatcher_Directory_Create_InNestedDirectory() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void FileSystemWatcher_Directory_Create_DeepDirectoryStructure() { @@ -64,7 +64,7 @@ public void FileSystemWatcher_Directory_Create_DeepDirectoryStructure() } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Create_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Delete.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Delete.cs index 156346710dd55..e61e4573bbc53 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Delete.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Delete.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests { public class Directory_Delete_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Delete() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -27,7 +27,7 @@ public void FileSystemWatcher_Directory_Delete() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Delete_InNestedDirectory() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -47,7 +47,7 @@ public void FileSystemWatcher_Directory_Delete_InNestedDirectory() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void FileSystemWatcher_Directory_Delete_DeepDirectoryStructure() { @@ -68,7 +68,7 @@ public void FileSystemWatcher_Directory_Delete_DeepDirectoryStructure() } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_Delete_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs index dd4ac34341a84..587da3771898d 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs @@ -15,7 +15,7 @@ public void Directory_Move_To_Same_Directory() DirectoryMove_SameDirectory(WatcherChangeTypes.Renamed); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void Directory_Move_From_Watched_To_Unwatched() { DirectoryMove_FromWatchedToUnwatched(WatcherChangeTypes.Deleted); @@ -35,13 +35,13 @@ public void Unix_Directory_Move_To_Different_Watched_Directory() DirectoryMove_DifferentWatchedDirectory(0); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void Directory_Move_From_Unwatched_To_Watched() { DirectoryMove_FromUnwatchedToWatched(WatcherChangeTypes.Created); } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [InlineData(false)] [InlineData(true)] public void Directory_Move_In_Nested_Directory(bool includeSubdirectories) @@ -49,7 +49,7 @@ public void Directory_Move_In_Nested_Directory(bool includeSubdirectories) DirectoryMove_NestedDirectory(includeSubdirectories ? WatcherChangeTypes.Renamed : 0, includeSubdirectories); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void Directory_Move_With_Set_NotifyFilter() { DirectoryMove_WithNotifyFilter(WatcherChangeTypes.Renamed); diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs index 201d69d85f3f7..65974fac52fc9 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs @@ -19,7 +19,7 @@ private static extern uint SetSecurityInfoByHandle( string name, uint objectType private const uint DACL_SECURITY_INFORMATION = 0x00000004; private const uint SE_FILE_OBJECT = 0x1; - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_Directory_NotifyFilter_Attributes(NotifyFilters filter) { @@ -46,7 +46,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_Attributes(NotifyFilters fi } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_Directory_NotifyFilter_CreationTime(NotifyFilters filter) { @@ -69,7 +69,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_CreationTime(NotifyFilters } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_Directory_NotifyFilter_DirectoryName(NotifyFilters filter) { @@ -94,7 +94,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_DirectoryName(NotifyFilters } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_Directory_NotifyFilter_LastAccessTime(NotifyFilters filter) { @@ -117,7 +117,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_LastAccessTime(NotifyFilter } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_Directory_NotifyFilter_LastWriteTime(NotifyFilters filter) { @@ -181,7 +181,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_Security(NotifyFilters filt /// /// Tests a changed event on a file when filtering for LastWrite and directory name. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_NotifyFilter_LastWriteAndFileName() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -201,7 +201,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_LastWriteAndFileName() /// Tests the watcher behavior when two events - a Modification and a Creation - happen closely /// after each other. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_NotifyFilter_ModifyAndCreate() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -228,7 +228,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_ModifyAndCreate() /// Tests the watcher behavior when two events - a Modification and a Deletion - happen closely /// after each other. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_Directory_NotifyFilter_ModifyAndDelete() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Changed.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Changed.cs index 00342eb04bdaf..00dd02e17f28a 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Changed.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Changed.cs @@ -9,7 +9,7 @@ namespace System.IO.Tests { public class File_Changed_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Changed_LastWrite() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -23,7 +23,7 @@ public void FileSystemWatcher_File_Changed_LastWrite() } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [InlineData(false)] [InlineData(true)] public void FileSystemWatcher_File_Changed_Nested(bool includeSubdirectories) @@ -46,7 +46,7 @@ public void FileSystemWatcher_File_Changed_Nested(bool includeSubdirectories) } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Changed_DataModification() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -65,7 +65,7 @@ public void FileSystemWatcher_File_Changed_DataModification() } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Changed_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs index ba379f3128e25..f85772d683602 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests { public class File_Create_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Create() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -26,7 +26,7 @@ public void FileSystemWatcher_File_Create() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Create_ForcedRestart() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -46,7 +46,7 @@ public void FileSystemWatcher_File_Create_ForcedRestart() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Create_InNestedDirectory() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -65,7 +65,7 @@ public void FileSystemWatcher_File_Create_InNestedDirectory() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void FileSystemWatcher_File_Create_DeepDirectoryStructure() { @@ -85,7 +85,7 @@ public void FileSystemWatcher_File_Create_DeepDirectoryStructure() } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Create_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Delete.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Delete.cs index b8317e2804132..c9f7a5149dfdd 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Delete.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Delete.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests { public class File_Delete_Tests : FileSystemWatcherTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Delete() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -27,7 +27,7 @@ public void FileSystemWatcher_File_Delete() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Delete_ForcedRestart() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -48,7 +48,7 @@ public void FileSystemWatcher_File_Delete_ForcedRestart() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Delete_InNestedDirectory() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -68,7 +68,7 @@ public void FileSystemWatcher_File_Delete_InNestedDirectory() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void FileSystemWatcher_File_Delete_DeepDirectoryStructure() { @@ -89,7 +89,7 @@ public void FileSystemWatcher_File_Delete_DeepDirectoryStructure() } } - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + [ConditionalFact(nameof(CanCreateSymbolicLinks), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_Delete_SymLink() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs index b0fcc81d3a820..0d23a66d752ad 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs @@ -15,14 +15,14 @@ public void Windows_File_Move_To_Same_Directory() FileMove_SameDirectory(WatcherChangeTypes.Renamed); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [PlatformSpecific(PlatformID.AnyUnix)] public void Unix_File_Move_To_Same_Directory() { FileMove_SameDirectory(WatcherChangeTypes.Created | WatcherChangeTypes.Deleted); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void File_Move_From_Watched_To_Unwatched() { FileMove_FromWatchedToUnwatched(WatcherChangeTypes.Deleted); @@ -42,14 +42,14 @@ public void OSX_File_Move_To_Different_Watched_Directory() FileMove_DifferentWatchedDirectory(WatcherChangeTypes.Changed); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [PlatformSpecific(PlatformID.Linux)] public void Linux_File_Move_To_Different_Watched_Directory() { FileMove_DifferentWatchedDirectory(0); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void File_Move_From_Unwatched_To_Watched() { FileMove_FromUnwatchedToWatched(WatcherChangeTypes.Created); @@ -64,7 +64,7 @@ public void Windows_File_Move_In_Nested_Directory(bool includeSubdirectories) FileMove_NestedDirectory(includeSubdirectories ? WatcherChangeTypes.Renamed : 0, includeSubdirectories); } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [InlineData(false)] [InlineData(true)] [PlatformSpecific(PlatformID.AnyUnix)] @@ -80,7 +80,7 @@ public void Windows_File_Move_With_Set_NotifyFilter() FileMove_WithNotifyFilter(WatcherChangeTypes.Renamed); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [PlatformSpecific(PlatformID.AnyUnix)] public void Unix_File_Move_With_Set_NotifyFilter() { diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs index 0e6ff8c4ba76d..898d3057a4e4b 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs @@ -21,7 +21,7 @@ private static extern uint SetSecurityInfoByHandle(string name, uint objectType, private const uint DACL_SECURITY_INFORMATION = 0x00000004; private const uint SE_FILE_OBJECT = 0x1; - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_Attributes(NotifyFilters filter) { @@ -49,7 +49,7 @@ public void FileSystemWatcher_File_NotifyFilter_Attributes(NotifyFilters filter) } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_CreationTime(NotifyFilters filter) { @@ -72,7 +72,7 @@ public void FileSystemWatcher_File_NotifyFilter_CreationTime(NotifyFilters filte } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_DirectoryName(NotifyFilters filter) { @@ -98,7 +98,7 @@ public void FileSystemWatcher_File_NotifyFilter_DirectoryName(NotifyFilters filt } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_LastAccessTime(NotifyFilters filter) { @@ -120,7 +120,7 @@ public void FileSystemWatcher_File_NotifyFilter_LastAccessTime(NotifyFilters fil } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_LastWriteTime(NotifyFilters filter) { @@ -142,7 +142,7 @@ public void FileSystemWatcher_File_NotifyFilter_LastWriteTime(NotifyFilters filt } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [MemberData(nameof(FilterTypes))] public void FileSystemWatcher_File_NotifyFilter_Size(NotifyFilters filter) { @@ -208,7 +208,7 @@ public void FileSystemWatcher_File_NotifyFilter_Security(NotifyFilters filter) /// /// Tests a changed event on a directory when filtering for LastWrite and FileName. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_NotifyFilter_LastWriteAndFileName() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -228,7 +228,7 @@ public void FileSystemWatcher_File_NotifyFilter_LastWriteAndFileName() /// Tests the watcher behavior when two events - a Modification and a Creation - happen closely /// after each other. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_NotifyFilter_ModifyAndCreate() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -255,7 +255,7 @@ public void FileSystemWatcher_File_NotifyFilter_ModifyAndCreate() /// Tests the watcher behavior when two events - a Modification and a Deletion - happen closely /// after each other. /// - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_File_NotifyFilter_ModifyAndDelete() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs index a7ff0fe1e93c6..fccea61093642 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs @@ -125,7 +125,7 @@ public void NonZeroTimeout_NoActivity_TimesOut(WatcherChangeTypes changeType, bo } } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] [InlineData(WatcherChangeTypes.Created)] [InlineData(WatcherChangeTypes.Deleted)] @@ -154,7 +154,7 @@ public void CreatedDeleted_Success(WatcherChangeTypes changeType) } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void Changed_Success() { @@ -179,7 +179,7 @@ public void Changed_Success() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [OuterLoop] public void Renamed_Success() { diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs index 76052cf84cd9d..2b6aaf0fa22eb 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs @@ -573,7 +573,7 @@ public void FileSystemWatcher_CreateManyConcurrentInstances() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 [PlatformSpecific(PlatformID.Linux)] [OuterLoop] public void FileSystemWatcher_CreateManyConcurrentWatches() @@ -608,7 +608,7 @@ public void FileSystemWatcher_CreateManyConcurrentWatches() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_StopCalledOnBackgroundThreadDoesNotDeadlock() { // Check the case where Stop or Dispose (they do the same thing) is called from @@ -644,7 +644,7 @@ public void FileSystemWatcher_StopCalledOnBackgroundThreadDoesNotDeadlock() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/216 public void FileSystemWatcher_WatchingAliasedFolderResolvesToRealPathWhenWatching() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs index c2986a943e4ee..38b9e6740963d 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs @@ -468,8 +468,18 @@ public void DriveLetter_Windows() [PlatformSpecific(PlatformID.AnyUnix)] public void DriveLetter_Unix() { - // On Unix, there's no special casing for drive letters, which are valid file names - var driveLetter = Create("C:"); + // On Unix, there's no special casing for drive letters. These may or may not be valid names, depending + // on the file system underlying the current directory. Unix file systems typically allow these, but, + // for example, these names are not allowed if running on a file system mounted from a Windows machine. + DirectoryInfo driveLetter; + try + { + driveLetter = Create("C:"); + } + catch (IOException) + { + return; + } var current = Create("."); Assert.Equal("C:", driveLetter.Name); Assert.Equal(Path.Combine(current.FullName, "C:"), driveLetter.FullName); diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs b/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs index 30284a83cc34d..d2b2e1cf167e9 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs @@ -62,7 +62,7 @@ public void MoveOntoParentDirectory() Assert.Throws(() => Move(testDir.FullName, Path.Combine(testDir.FullName, ".."))); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void BasicMove() { string testDirSource = Path.Combine(TestDirectory, GetTestFileName()); @@ -73,7 +73,7 @@ public void BasicMove() Assert.True(Directory.Exists(testDirDest)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void MultipleMoves() { string testDir = GetTestFilePath(); @@ -89,7 +89,7 @@ public void MultipleMoves() Assert.False(Directory.Exists(testDirSource)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void DirectoryNameWithSpaces() { string testDirSource = Path.Combine(TestDirectory, GetTestFileName()); @@ -100,7 +100,7 @@ public void DirectoryNameWithSpaces() Assert.True(Directory.Exists(testDirDest)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void TrailingDirectorySeparators() { string testDirSource = Path.Combine(TestDirectory, GetTestFileName()); @@ -111,7 +111,7 @@ public void TrailingDirectorySeparators() Assert.True(Directory.Exists(testDirDest)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void IncludeSubdirectories() { string testDirSource = Path.Combine(TestDirectory, GetTestFileName()); @@ -178,7 +178,7 @@ public void WindowsWildCharacterPath() Assert.Throws(() => Move(TestDirectory, "*Test")); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 [PlatformSpecific(PlatformID.AnyUnix)] public void UnixWildCharacterPath() { @@ -218,7 +218,7 @@ public void WindowsWhitespacePath() Assert.Throws(() => Move(testDir.FullName, "\t")); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 [PlatformSpecific(PlatformID.AnyUnix)] public void UnixWhitespacePath() { @@ -260,7 +260,7 @@ public void BetweenDriveLabels() Assert.Throws(() => Move(path, "D:\\DoesntExist")); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 [PlatformSpecific(PlatformID.AnyUnix)] public void UnixExistingDirectory() { diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs index 264e63224f7be..082aa0d7def33 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs @@ -24,7 +24,7 @@ public virtual void Move(DirectoryInfo sourceDir, string destDir) #region UniversalTests - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void DirectoryPathUpdatesOnMove() { //NOTE: MoveTo adds a trailing separator character to the FullName of a DirectoryInfo diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Refresh.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Refresh.cs index afb6bf9f56f79..099de0d1e77ae 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Refresh.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Refresh.cs @@ -19,7 +19,7 @@ public void DeleteThenRefresh() Assert.False(testDir.Exists); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1008 public void NameChange() { //NOTE: MoveTo adds a trailing slash to the path of the DirectoryInfo diff --git a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs index 8316169c42fac..f38d72c47e839 100644 --- a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs +++ b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs @@ -79,7 +79,7 @@ public static void ClonedClient_ActsAsOriginalClient() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1012 [PlatformSpecific(PlatformID.Linux)] public static void Linux_BufferSizeRoundtrips() { diff --git a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs index 4677539e2345b..3ff5ec8dc8407 100644 --- a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs +++ b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs @@ -365,7 +365,7 @@ public async Task Windows_OperationsOnNamedServerWithDisposedClient() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1011 [PlatformSpecific(PlatformID.AnyUnix)] public async Task Unix_OperationsOnNamedServerWithDisposedClient() { diff --git a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs index 1e94cb678a0ea..052c2ac18b353 100644 --- a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs +++ b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs @@ -210,7 +210,7 @@ public async Task Windows_GetImpersonationUserName_Succeed() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1011 [PlatformSpecific(PlatformID.AnyUnix)] public async Task Unix_GetImpersonationUserName_Succeed() { diff --git a/src/libraries/System.IO.Pipes/tests/PipeTest.Read.cs b/src/libraries/System.IO.Pipes/tests/PipeTest.Read.cs index f09e17230e720..233e21bdca1b7 100644 --- a/src/libraries/System.IO.Pipes/tests/PipeTest.Read.cs +++ b/src/libraries/System.IO.Pipes/tests/PipeTest.Read.cs @@ -140,7 +140,7 @@ public virtual void WriteToReadOnlyPipe_Throws_NotSupportedException() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/975 public async Task ReadWithZeroLengthBuffer_Nop() { using (ServerClientPair pair = CreateServerClientPair()) diff --git a/src/libraries/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj b/src/libraries/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj index 689b3a9b69a00..1069a5d5f1bd4 100644 --- a/src/libraries/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj +++ b/src/libraries/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj @@ -53,6 +53,9 @@ Common\System\IO\FileCleanupTestBase.cs + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryDivideTests.cs b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryDivideTests.cs index d280674608e4d..cd1d4c0689a57 100644 --- a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryDivideTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryDivideTests.cs @@ -11,7 +11,7 @@ public static class BinaryDivideTests { #region Test methods - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckByteDivideTest() { byte[] array = new byte[] { 0, 1, byte.MaxValue }; @@ -24,7 +24,7 @@ public static void CheckByteDivideTest() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckSByteDivideTest() { sbyte[] array = new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }; @@ -37,7 +37,8 @@ public static void CheckSByteDivideTest() } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckUShortDivideTest(bool useInterpreter) { ushort[] array = new ushort[] { 0, 1, ushort.MaxValue }; @@ -50,7 +51,8 @@ public static void CheckUShortDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckShortDivideTest(bool useInterpreter) { short[] array = new short[] { 0, 1, -1, short.MinValue, short.MaxValue }; @@ -63,7 +65,8 @@ public static void CheckShortDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckUIntDivideTest(bool useInterpreter) { uint[] array = new uint[] { 0, 1, uint.MaxValue }; @@ -76,7 +79,8 @@ public static void CheckUIntDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckIntDivideTest(bool useInterpreter) { int[] array = new int[] { 0, 1, -1, int.MinValue, int.MaxValue }; @@ -89,7 +93,8 @@ public static void CheckIntDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckULongDivideTest(bool useInterpreter) { ulong[] array = new ulong[] { 0, 1, ulong.MaxValue }; @@ -102,7 +107,8 @@ public static void CheckULongDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLongDivideTest(bool useInterpreter) { long[] array = new long[] { 0, 1, -1, long.MinValue, long.MaxValue }; @@ -154,7 +160,7 @@ public static void CheckDecimalDivideTest(bool useInterpreter) } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckCharDivideTest() { char[] array = new char[] { '\0', '\b', 'A', '\uffff' }; diff --git a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryModuloTests.cs b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryModuloTests.cs index d43b2d1daaf11..09f50302d98e8 100644 --- a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryModuloTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryModuloTests.cs @@ -11,7 +11,7 @@ public static class BinaryModuloTests { #region Test methods - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckByteModuloTest() { byte[] array = new byte[] { 0, 1, byte.MaxValue }; @@ -24,7 +24,7 @@ public static void CheckByteModuloTest() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckSByteModuloTest() { sbyte[] array = new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }; @@ -37,7 +37,8 @@ public static void CheckSByteModuloTest() } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckUShortModuloTest(bool useInterpreter) { ushort[] array = new ushort[] { 0, 1, ushort.MaxValue }; @@ -50,7 +51,8 @@ public static void CheckUShortModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckShortModuloTest(bool useInterpreter) { short[] array = new short[] { 0, 1, -1, short.MinValue, short.MaxValue }; @@ -63,7 +65,8 @@ public static void CheckShortModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckUIntModuloTest(bool useInterpreter) { uint[] array = new uint[] { 0, 1, uint.MaxValue }; @@ -76,7 +79,8 @@ public static void CheckUIntModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckIntModuloTest(bool useInterpreter) { int[] array = new int[] { 0, 1, -1, int.MinValue, int.MaxValue }; @@ -89,7 +93,8 @@ public static void CheckIntModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckULongModuloTest(bool useInterpreter) { ulong[] array = new ulong[] { 0, 1, ulong.MaxValue }; @@ -102,7 +107,8 @@ public static void CheckULongModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLongModuloTest(bool useInterpreter) { long[] array = new long[] { 0, 1, -1, long.MinValue, long.MaxValue }; @@ -154,7 +160,7 @@ public static void CheckDecimalModuloTest(bool useInterpreter) } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckCharModuloTest() { char[] array = new char[] { '\0', '\b', 'A', '\uffff' }; diff --git a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableDivideTests.cs b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableDivideTests.cs index c6bcfd5a58d7f..28d85972945b0 100644 --- a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableDivideTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableDivideTests.cs @@ -10,7 +10,7 @@ public static class BinaryNullableDivideTests { #region Test methods - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckNullableByteDivideTest() { byte?[] array = { 0, 1, byte.MaxValue, null }; @@ -23,7 +23,7 @@ public static void CheckNullableByteDivideTest() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckNullableSByteDivideTest() { sbyte?[] array = { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue, null }; @@ -36,7 +36,8 @@ public static void CheckNullableSByteDivideTest() } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableUShortDivideTest(bool useInterpreter) { ushort?[] array = { 0, 1, ushort.MaxValue, null }; @@ -49,7 +50,8 @@ public static void CheckNullableUShortDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableShortDivideTest(bool useInterpreter) { short?[] array = { 0, 1, -1, short.MinValue, short.MaxValue, null }; @@ -62,7 +64,8 @@ public static void CheckNullableShortDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableUIntDivideTest(bool useInterpreter) { uint?[] array = { 0, 1, uint.MaxValue, null }; @@ -75,7 +78,8 @@ public static void CheckNullableUIntDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableIntDivideTest(bool useInterpreter) { int?[] array = { 0, 1, -1, int.MinValue, int.MaxValue, null }; @@ -88,7 +92,8 @@ public static void CheckNullableIntDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableULongDivideTest(bool useInterpreter) { ulong?[] array = { 0, 1, ulong.MaxValue, null }; @@ -101,7 +106,8 @@ public static void CheckNullableULongDivideTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableLongDivideTest(bool useInterpreter) { long?[] array = { 0, 1, -1, long.MinValue, long.MaxValue, null }; @@ -153,7 +159,7 @@ public static void CheckNullableDecimalDivideTest(bool useInterpreter) } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void CheckNullableCharDivideTest() { char?[] array = { '\0', '\b', 'A', '\uffff', null }; diff --git a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableModuloTests.cs b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableModuloTests.cs index 1271236e4cfb9..6738119a2da22 100644 --- a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableModuloTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/BinaryNullableModuloTests.cs @@ -36,7 +36,8 @@ public static void CheckNullableSByteModuloTest() } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableUShortModuloTest(bool useInterpreter) { ushort?[] array = { 0, 1, ushort.MaxValue, null }; @@ -49,7 +50,8 @@ public static void CheckNullableUShortModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableShortModuloTest(bool useInterpreter) { short?[] array = { 0, 1, -1, short.MinValue, short.MaxValue, null }; @@ -62,7 +64,8 @@ public static void CheckNullableShortModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableUIntModuloTest(bool useInterpreter) { uint?[] array = { 0, 1, uint.MaxValue, null }; @@ -75,7 +78,8 @@ public static void CheckNullableUIntModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableIntModuloTest(bool useInterpreter) { int?[] array = { 0, 1, -1, int.MinValue, int.MaxValue, null }; @@ -88,7 +92,8 @@ public static void CheckNullableIntModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableULongModuloTest(bool useInterpreter) { ulong?[] array = { 0, 1, ulong.MaxValue, null }; @@ -101,7 +106,8 @@ public static void CheckNullableULongModuloTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckNullableLongModuloTest(bool useInterpreter) { long?[] array = { 0, 1, -1, long.MinValue, long.MaxValue, null }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideNullableTests.cs b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideNullableTests.cs index 574894341c0d9..a0fb5e7ab23cb 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideNullableTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideNullableTests.cs @@ -50,7 +50,8 @@ public static void LambdaDivideNullableFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableIntTest(bool useInterpreter) { int?[] values = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }; @@ -63,7 +64,8 @@ public static void LambdaDivideNullableIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableLongTest(bool useInterpreter) { long?[] values = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }; @@ -76,7 +78,8 @@ public static void LambdaDivideNullableLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableShortTest(bool useInterpreter) { short?[] values = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }; @@ -89,7 +92,8 @@ public static void LambdaDivideNullableShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableUIntTest(bool useInterpreter) { uint?[] values = new uint?[] { null, 0, 1, uint.MaxValue }; @@ -102,7 +106,8 @@ public static void LambdaDivideNullableUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableULongTest(bool useInterpreter) { ulong?[] values = new ulong?[] { null, 0, 1, ulong.MaxValue }; @@ -115,7 +120,8 @@ public static void LambdaDivideNullableULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideNullableUShortTest(bool useInterpreter) { ushort?[] values = new ushort?[] { null, 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideTests.cs b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideTests.cs index 87b43cfeff10a..4bcf440388976 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaDivideTests.cs @@ -50,7 +50,8 @@ public static void LambdaDivideFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideIntTest(bool useInterpreter) { int[] values = new int[] { 0, 1, -1, int.MinValue, int.MaxValue }; @@ -63,7 +64,8 @@ public static void LambdaDivideIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideLongTest(bool useInterpreter) { long[] values = new long[] { 0, 1, -1, long.MinValue, long.MaxValue }; @@ -76,7 +78,8 @@ public static void LambdaDivideLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideShortTest(bool useInterpreter) { short[] values = new short[] { 0, 1, -1, short.MinValue, short.MaxValue }; @@ -89,7 +92,8 @@ public static void LambdaDivideShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideUIntTest(bool useInterpreter) { uint[] values = new uint[] { 0, 1, uint.MaxValue }; @@ -102,7 +106,8 @@ public static void LambdaDivideUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideULongTest(bool useInterpreter) { ulong[] values = new ulong[] { 0, 1, ulong.MaxValue }; @@ -115,7 +120,8 @@ public static void LambdaDivideULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaDivideUShortTest(bool useInterpreter) { ushort[] values = new ushort[] { 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloNullableTests.cs b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloNullableTests.cs index 30ce31b64ea9e..374073fc2b693 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloNullableTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloNullableTests.cs @@ -50,7 +50,8 @@ public static void LambdaModuloNullableFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableIntTest(bool useInterpreter) { int?[] values = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }; @@ -63,7 +64,8 @@ public static void LambdaModuloNullableIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableLongTest(bool useInterpreter) { long?[] values = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }; @@ -76,7 +78,8 @@ public static void LambdaModuloNullableLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableShortTest(bool useInterpreter) { short?[] values = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }; @@ -89,7 +92,8 @@ public static void LambdaModuloNullableShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableUIntTest(bool useInterpreter) { uint?[] values = new uint?[] { null, 0, 1, uint.MaxValue }; @@ -102,7 +106,8 @@ public static void LambdaModuloNullableUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableULongTest(bool useInterpreter) { ulong?[] values = new ulong?[] { null, 0, 1, ulong.MaxValue }; @@ -115,7 +120,8 @@ public static void LambdaModuloNullableULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloNullableUShortTest(bool useInterpreter) { ushort?[] values = new ushort?[] { null, 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloTests.cs b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloTests.cs index 17757a172d353..aade37deb3bce 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lambda/LambdaModuloTests.cs @@ -50,7 +50,8 @@ public static void LambdaModuloFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloIntTest(bool useInterpreter) { int[] values = new int[] { 0, 1, -1, int.MinValue, int.MaxValue }; @@ -63,7 +64,8 @@ public static void LambdaModuloIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloLongTest(bool useInterpreter) { long[] values = new long[] { 0, 1, -1, long.MinValue, long.MaxValue }; @@ -76,7 +78,8 @@ public static void LambdaModuloLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloShortTest(bool useInterpreter) { short[] values = new short[] { 0, 1, -1, short.MinValue, short.MaxValue }; @@ -89,7 +92,8 @@ public static void LambdaModuloShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloUIntTest(bool useInterpreter) { uint[] values = new uint[] { 0, 1, uint.MaxValue }; @@ -102,7 +106,8 @@ public static void LambdaModuloUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloULongTest(bool useInterpreter) { ulong[] values = new ulong[] { 0, 1, ulong.MaxValue }; @@ -115,7 +120,8 @@ public static void LambdaModuloULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void LambdaModuloUShortTest(bool useInterpreter) { ushort[] values = new ushort[] { 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedDivideNullableTests.cs b/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedDivideNullableTests.cs index a41c343c64bf9..4b31641b6dac0 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedDivideNullableTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedDivideNullableTests.cs @@ -12,7 +12,8 @@ public static class LiftedDivideNullableTests { #region Test methods - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableByteTest(bool useInterpreter) { byte?[] values = new byte?[] { null, 0, 1, byte.MaxValue }; @@ -25,7 +26,8 @@ public static void CheckLiftedDivideNullableByteTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableCharTest(bool useInterpreter) { char?[] values = new char?[] { null, '\0', '\b', 'A', '\uffff' }; @@ -77,7 +79,8 @@ public static void CheckLiftedDivideNullableFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableIntTest(bool useInterpreter) { int?[] values = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }; @@ -90,7 +93,8 @@ public static void CheckLiftedDivideNullableIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableLongTest(bool useInterpreter) { long?[] values = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }; @@ -103,7 +107,8 @@ public static void CheckLiftedDivideNullableLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableSByteTest(bool useInterpreter) { sbyte?[] values = new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }; @@ -116,7 +121,8 @@ public static void CheckLiftedDivideNullableSByteTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableShortTest(bool useInterpreter) { short?[] values = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }; @@ -129,7 +135,8 @@ public static void CheckLiftedDivideNullableShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableUIntTest(bool useInterpreter) { uint?[] values = new uint?[] { null, 0, 1, uint.MaxValue }; @@ -142,7 +149,8 @@ public static void CheckLiftedDivideNullableUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableULongTest(bool useInterpreter) { ulong?[] values = new ulong?[] { null, 0, 1, ulong.MaxValue }; @@ -155,7 +163,8 @@ public static void CheckLiftedDivideNullableULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedDivideNullableUShortTest(bool useInterpreter) { ushort?[] values = new ushort?[] { null, 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedModuloNullableTests.cs b/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedModuloNullableTests.cs index 80e5a316cea70..e18a23da156c6 100644 --- a/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedModuloNullableTests.cs +++ b/src/libraries/System.Linq.Expressions/tests/Lifted/LiftedModuloNullableTests.cs @@ -12,7 +12,8 @@ public static class LiftedModuloNullableTests { #region Test methods - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableByteTest(bool useInterpreter) { byte?[] values = new byte?[] { null, 0, 1, byte.MaxValue }; @@ -25,7 +26,8 @@ public static void CheckLiftedModuloNullableByteTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableCharTest(bool useInterpreter) { char?[] values = new char?[] { null, '\0', '\b', 'A', '\uffff' }; @@ -77,7 +79,8 @@ public static void CheckLiftedModuloNullableFloatTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableIntTest(bool useInterpreter) { int?[] values = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }; @@ -90,7 +93,8 @@ public static void CheckLiftedModuloNullableIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableLongTest(bool useInterpreter) { long?[] values = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }; @@ -103,7 +107,8 @@ public static void CheckLiftedModuloNullableLongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableSByteTest(bool useInterpreter) { sbyte?[] values = new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }; @@ -116,7 +121,8 @@ public static void CheckLiftedModuloNullableSByteTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableShortTest(bool useInterpreter) { short?[] values = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }; @@ -129,7 +135,8 @@ public static void CheckLiftedModuloNullableShortTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableUIntTest(bool useInterpreter) { uint?[] values = new uint?[] { null, 0, 1, uint.MaxValue }; @@ -142,7 +149,8 @@ public static void CheckLiftedModuloNullableUIntTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableULongTest(bool useInterpreter) { ulong?[] values = new ulong?[] { null, 0, 1, ulong.MaxValue }; @@ -155,7 +163,8 @@ public static void CheckLiftedModuloNullableULongTest(bool useInterpreter) } } - [Theory, ClassData(typeof(CompilationTypes))] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 + [ClassData(typeof(CompilationTypes))] public static void CheckLiftedModuloNullableUShortTest(bool useInterpreter) { ushort?[] values = new ushort?[] { null, 0, 1, ushort.MaxValue }; diff --git a/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj b/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj index 58dab1c03f53e..f7f879210618c 100644 --- a/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj +++ b/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj @@ -217,6 +217,9 @@ + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.Linq/tests/SkipWhileTests.cs b/src/libraries/System.Linq/tests/SkipWhileTests.cs index 4afd754764b0e..58e47ae8300df 100644 --- a/src/libraries/System.Linq/tests/SkipWhileTests.cs +++ b/src/libraries/System.Linq/tests/SkipWhileTests.cs @@ -34,7 +34,7 @@ public void SkipWhileThrowsOnNull() Assert.Throws("predicate", () => Enumerable.Range(0, 20).SkipWhile((Func)null)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void SkipWhilePassesPredicateExceptionWhenEnumerated() { var source = Enumerable.Range(-2, 5).SkipWhile(i => 1 / i <= 0); diff --git a/src/libraries/System.Linq/tests/System.Linq.Tests.csproj b/src/libraries/System.Linq/tests/System.Linq.Tests.csproj index 62a60d95eb541..68039a6c45abd 100644 --- a/src/libraries/System.Linq/tests/System.Linq.Tests.csproj +++ b/src/libraries/System.Linq/tests/System.Linq.Tests.csproj @@ -73,6 +73,9 @@ + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs index 5290216703eee..c182e7359df32 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs @@ -196,7 +196,7 @@ public async Task SendAsync_SimpleGet_Success(Uri remoteServer) } [OuterLoop] // TODO: Issue #11345 - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [MemberData(nameof(GetAsync_IPBasedUri_Success_MemberData))] public async Task GetAsync_IPBasedUri_Success(IPAddress address) { diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkChangeTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkChangeTest.cs index 8b68a68a7a9f5..ddc14a1724ae6 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkChangeTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkChangeTest.cs @@ -8,7 +8,7 @@ namespace System.Net.NetworkInformation.Tests { public class NetworkChangeTest { - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void NetworkAddressChanged_AddRemove_Success() { NetworkAddressChangedEventHandler handler = NetworkChange_NetworkAddressChanged; diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs index eb9f6a40c3c29..fd75dd94aa9ac 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs @@ -20,7 +20,7 @@ public NetworkInterfaceBasicTest() _log = TestLogging.GetInstance(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void BasicTest_GetNetworkInterfaces_AtLeastOne() { Assert.NotEqual(0, NetworkInterface.GetAllNetworkInterfaces().Length); @@ -108,7 +108,7 @@ public void BasicTest_AccessInstanceProperties_NoExceptions_Osx() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv4", "true")] public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface() { @@ -130,7 +130,7 @@ public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv4", "true")] public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported() { @@ -139,7 +139,7 @@ public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported() _log.WriteLine("Loopback IPv4 index: " + NetworkInterface.LoopbackInterfaceIndex); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv6", "true")] public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface() { @@ -163,7 +163,7 @@ public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv6", "true")] public void BasicTest_StaticIPv6LoopbackIndex_ExceptionIfV6NotSupported() { @@ -246,13 +246,13 @@ public void BasicTest_GetIPInterfaceStatistics_Success_OSX() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void BasicTest_GetIsNetworkAvailable_Success() { Assert.True(NetworkInterface.GetIsNetworkAvailable()); } - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [PlatformSpecific(~PlatformID.OSX)] [InlineData(false)] [InlineData(true)] diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj index 55c55d4201ea3..cca4329c521a9 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj @@ -76,6 +76,9 @@ Common\System\IO\RowConfigReader.cs + + Common\tests\System\PlatformDetection.cs + diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs index 24e13b1022ba0..526f247f853fc 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -59,7 +59,7 @@ public async Task SendPingAsync_InvalidArgs() Assert.Throws("buffer", () => { p.SendPingAsync(TestSettings.LocalHost, 1, new byte[65501]); }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithIPAddress() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -73,7 +73,7 @@ await SendBatchPingAsync( }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithIPAddress_AddressAsString() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -87,7 +87,7 @@ await SendBatchPingAsync( }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithIPAddressAndTimeout() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -120,7 +120,7 @@ await SendBatchPingAsync( } [PlatformSpecific(PlatformID.AnyUnix)] - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithIPAddressAndTimeoutAndBuffer_Unix() { byte[] buffer = TestSettings.PayloadAsBytes; @@ -165,7 +165,7 @@ await SendBatchPingAsync( } [PlatformSpecific(PlatformID.AnyUnix)] - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithIPAddressAndTimeoutAndBufferAndPingOptions_Unix() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -190,7 +190,7 @@ await SendBatchPingAsync( }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithHost() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -204,7 +204,7 @@ await SendBatchPingAsync( }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithHostAndTimeout() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -237,7 +237,7 @@ await SendBatchPingAsync( } [PlatformSpecific(PlatformID.AnyUnix)] - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithHostAndTimeoutAndBuffer_Unix() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -281,7 +281,7 @@ await SendBatchPingAsync( } [PlatformSpecific(PlatformID.AnyUnix)] - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public async Task SendPingAsyncWithHostAndTimeoutAndBufferAndPingOptions_Unix() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); @@ -306,7 +306,7 @@ await SendBatchPingAsync( }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 public static async Task SendPings_ReuseInstance_Hostname() { IPAddress localIpAddress = await TestSettings.GetLocalIPAddress(); diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj b/src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj index 2f21e73ce078b..01f30abc5e7f5 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj @@ -30,6 +30,9 @@ Common\System\Net\Capability.RawSocketPermissions.cs + + Common\tests\System\PlatformDetection.cs + diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs index b1fa97b76d5e7..a34ed9e12afae 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs @@ -17,7 +17,7 @@ public class UnixPingUtilityTests { private const int IcmpHeaderLengthInBytes = 8; - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/561 [InlineData(0)] [InlineData(1)] [InlineData(50)] diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs index 269c38907e0ac..a25754c3951ff 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs @@ -510,7 +510,7 @@ public void ConnectAsyncV6IPEndPointToV6Host_Success() DualModeConnectAsync_IPEndPointToHost_Helper(IPAddress.IPv6Loopback, IPAddress.IPv6Loopback, false); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void ConnectAsyncV4IPEndPointToV6Host_Fails() { Assert.Throws(() => @@ -519,7 +519,7 @@ public void ConnectAsyncV4IPEndPointToV6Host_Fails() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void ConnectAsyncV6IPEndPointToV4Host_Fails() { Assert.Throws(() => @@ -620,8 +620,7 @@ public void DualModeConnectAsync_Static_DnsEndPointToHost_Helper(IPAddress liste [Trait("IPv6", "true")] public class DualModeBind : DualModeBase { - [Fact] // Base case - // "The system detected an invalid pointer address in attempting to use a pointer argument in a call" + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void Socket_BindV4IPEndPoint_Throws() { Assert.Throws(() => @@ -672,8 +671,7 @@ public void Socket_BindDnsEndPoint_Throws() }); } - [Fact] - // "An invalid argument was supplied" + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void Socket_EnableDualModeAfterV4Bind_Throws() { using (Socket serverSocket = new Socket(SocketType.Stream, ProtocolType.Tcp)) @@ -1011,8 +1009,7 @@ public class DualModeConnectionlessSendTo : DualModeBase { #region SendTo Sync IPEndPoint - [Fact] // Base case - // "The system detected an invalid pointer address in attempting to use a pointer argument in a call" + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void Socket_SendToV4IPEndPointToV4Host_Throws() { Socket socket = new Socket(SocketType.Dgram, ProtocolType.Udp); @@ -1106,8 +1103,7 @@ public class DualModeConnectionlessBeginSendTo : DualModeBase { #region SendTo Begin/End - [Fact] // Base case - // "The system detected an invalid pointer address in attempting to use a pointer argument in a call" + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void Socket_BeginSendToV4IPEndPointToV4Host_Throws() { Socket socket = new Socket(SocketType.Dgram, ProtocolType.Udp); @@ -1205,7 +1201,7 @@ public class DualModeConnectionlessSendToAsync : DualModeBase { #region SendTo Async/Event - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 public void Socket_SendToAsyncV4IPEndPointToV4Host_Throws() { Socket socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp); @@ -1422,7 +1418,7 @@ public void ReceiveFromV4BoundToSpecificV6_NotReceived() // with the socket's address family fail. We've decided that this is // an acceptable difference due to the extra state that would otherwise // be necessary to emulate the Winsock behavior. - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 [PlatformSpecific(PlatformID.Linux)] public void ReceiveFromV4BoundToSpecificV6_NotReceived_Linux() { @@ -1562,7 +1558,7 @@ public void BeginReceiveFromV4BoundToSpecificV6_NotReceived() // with the socket's address family fail. We've decided that this is // an acceptable difference due to the extra state that would otherwise // be necessary to emulate the Winsock behavior. - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/982 [PlatformSpecific(PlatformID.Linux)] public void BeginReceiveFromV4BoundToSpecificV6_NotReceived_Linux() { @@ -1861,49 +1857,49 @@ public void Socket_ReceiveMessageFromDnsEndPoint_Throws() } } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV4BoundToSpecificMappedV4_Success() { ReceiveMessageFrom_Helper(IPAddress.Loopback.MapToIPv6(), IPAddress.Loopback); } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV4BoundToAnyMappedV4_Success() { ReceiveMessageFrom_Helper(IPAddress.Any.MapToIPv6(), IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV4BoundToSpecificV4_Success() { ReceiveMessageFrom_Helper(IPAddress.Loopback, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV4BoundToAnyV4_Success() { ReceiveMessageFrom_Helper(IPAddress.Any, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV6BoundToSpecificV6_Success() { ReceiveMessageFrom_Helper(IPAddress.IPv6Loopback, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV6BoundToAnyV6_Success() { ReceiveMessageFrom_Helper(IPAddress.IPv6Any, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV6BoundToSpecificV4_NotReceived() { @@ -1930,7 +1926,7 @@ public void ReceiveMessageFromV4BoundToSpecificV6_NotReceived() // with the socket's address family fail. We've decided that this is // an acceptable difference due to the extra state that would otherwise // be necessary to emulate the Winsock behavior. - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(PlatformID.Linux)] public void ReceiveMessageFromV4BoundToSpecificV6_NotReceived_Linux() { @@ -1940,7 +1936,7 @@ public void ReceiveMessageFromV4BoundToSpecificV6_NotReceived_Linux() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV6BoundToAnyV4_NotReceived() { @@ -1950,7 +1946,7 @@ public void ReceiveMessageFromV6BoundToAnyV4_NotReceived() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromV4BoundToAnyV6_Success() { @@ -2016,7 +2012,7 @@ private void ReceiveMessageFrom_Helper(IPAddress listenOn, IPAddress connectTo, } } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 // "The supplied EndPoint of AddressFamily InterNetwork is not valid for this Socket, use InterNetworkV6 instead." public void Socket_BeginReceiveMessageFromV4IPEndPointFromV4Client_Throws() { @@ -2032,7 +2028,7 @@ public void Socket_BeginReceiveMessageFromV4IPEndPointFromV4Client_Throws() }); } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] // "The parameter remoteEP must not be of type DnsEndPoint." public void Socket_BeginReceiveMessageFromDnsEndPoint_Throws() @@ -2050,49 +2046,49 @@ public void Socket_BeginReceiveMessageFromDnsEndPoint_Throws() } } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV4BoundToSpecificMappedV4_Success() { BeginReceiveMessageFrom_Helper(IPAddress.Loopback.MapToIPv6(), IPAddress.Loopback); } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV4BoundToAnyMappedV4_Success() { BeginReceiveMessageFrom_Helper(IPAddress.Any.MapToIPv6(), IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV4BoundToSpecificV4_Success() { BeginReceiveMessageFrom_Helper(IPAddress.Loopback, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV4BoundToAnyV4_Success() { BeginReceiveMessageFrom_Helper(IPAddress.Any, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV6BoundToSpecificV6_Success() { BeginReceiveMessageFrom_Helper(IPAddress.IPv6Loopback, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV6BoundToAnyV6_Success() { BeginReceiveMessageFrom_Helper(IPAddress.IPv6Any, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV6BoundToSpecificV4_NotReceived() { @@ -2119,7 +2115,7 @@ public void BeginReceiveMessageFromV4BoundToSpecificV6_NotReceived() // with the socket's address family fail. We've decided that this is // an acceptable difference due to the extra state that would otherwise // be necessary to emulate the Winsock behavior. - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(PlatformID.Linux)] public void BeginReceiveMessageFromV4BoundToSpecificV6_NotReceived_Linux() { @@ -2129,7 +2125,7 @@ public void BeginReceiveMessageFromV4BoundToSpecificV6_NotReceived_Linux() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV6BoundToAnyV4_NotReceived() { @@ -2139,7 +2135,7 @@ public void BeginReceiveMessageFromV6BoundToAnyV4_NotReceived() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void BeginReceiveMessageFromV4BoundToAnyV6_Success() { @@ -2186,7 +2182,7 @@ private void BeginReceiveMessageFrom_Helper(IPAddress listenOn, IPAddress connec } } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 // "The supplied EndPoint of AddressFamily InterNetwork is not valid for this Socket, use InterNetworkV6 instead." public void Socket_ReceiveMessageFromAsyncV4IPEndPointFromV4Client_Throws() { @@ -2203,7 +2199,7 @@ public void Socket_ReceiveMessageFromAsyncV4IPEndPointFromV4Client_Throws() }); } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] // "The parameter remoteEP must not be of type DnsEndPoint." public void Socket_ReceiveMessageFromAsyncDnsEndPoint_Throws() @@ -2223,49 +2219,49 @@ public void Socket_ReceiveMessageFromAsyncDnsEndPoint_Throws() } } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV4BoundToSpecificMappedV4_Success() { ReceiveMessageFromAsync_Helper(IPAddress.Loopback.MapToIPv6(), IPAddress.Loopback); } - [Fact] // Base case + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV4BoundToAnyMappedV4_Success() { ReceiveMessageFromAsync_Helper(IPAddress.Any.MapToIPv6(), IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV4BoundToSpecificV4_Success() { ReceiveMessageFromAsync_Helper(IPAddress.Loopback, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV4BoundToAnyV4_Success() { ReceiveMessageFromAsync_Helper(IPAddress.Any, IPAddress.Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV6BoundToSpecificV6_Success() { ReceiveMessageFromAsync_Helper(IPAddress.IPv6Loopback, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV6BoundToAnyV6_Success() { ReceiveMessageFromAsync_Helper(IPAddress.IPv6Any, IPAddress.IPv6Loopback); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV6BoundToSpecificV4_NotReceived() { @@ -2292,7 +2288,7 @@ public void ReceiveMessageFromAsyncV4BoundToSpecificV6_NotReceived() // with the socket's address family fail. We've decided that this is // an acceptable difference due to the extra state that would otherwise // be necessary to emulate the Winsock behavior. - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(PlatformID.Linux)] public void ReceiveMessageFromAsyncV4BoundToSpecificV6_NotReceived_Linux() { @@ -2302,7 +2298,7 @@ public void ReceiveMessageFromAsyncV4BoundToSpecificV6_NotReceived_Linux() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV6BoundToAnyV4_NotReceived() { @@ -2312,7 +2308,7 @@ public void ReceiveMessageFromAsyncV6BoundToAnyV4_NotReceived() }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 [PlatformSpecific(~PlatformID.OSX)] public void ReceiveMessageFromAsyncV4BoundToAnyV6_Success() { diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs index f62c023ac8e0a..9e658aaab219a 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs @@ -28,7 +28,7 @@ public void GetHashCode_DefaultValues_Success() Assert.Equal(default(IPPacketInformation).GetHashCode(), default(IPPacketInformation).GetHashCode()); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 public void Equals_NonDefaultValue_Success() { IPPacketInformation packetInfo = GetNonDefaultIPPacketInformation(); @@ -43,7 +43,7 @@ public void Equals_NonDefaultValue_Success() Assert.True(packetInfo != default(IPPacketInformation)); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 public void GetHashCode_NonDefaultValue_Succes() { IPPacketInformation packetInfo = GetNonDefaultIPPacketInformation(); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs index bb7bdd6060e0e..201b73a591a85 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs @@ -9,7 +9,7 @@ namespace System.Net.Sockets.Tests public class ReceiveMessageFrom { [OuterLoop] // TODO: Issue #11345 - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 public void Success() { if (Socket.OSSupportsIPv4) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFromAsync.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFromAsync.cs index 0ab568edccf65..6f12a8336dd86 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFromAsync.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFromAsync.cs @@ -18,7 +18,7 @@ public void OnCompleted(object sender, SocketAsyncEventArgs args) } [OuterLoop] // TODO: Issue #11345 - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/987 public void Success() { ManualResetEvent completed = new ManualResetEvent(false); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs index ab52b09ddf280..1dc0dd1879fce 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs @@ -146,7 +146,7 @@ public void Select_Read_OneReadyAtATime(int reads) } [PlatformSpecific(~PlatformID.OSX)] // typical OSX install has very low max open file descriptors value - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/989 public void Select_Error_OneReadyAtATime() { const int Errors = 90; // value larger than the internal value in SocketPal.Unix that swaps between stack and heap allocation diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs index 8ea8fbc9a5bee..bd609debb7bc7 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs @@ -136,7 +136,11 @@ private async Task MulticastInterface_Set_Helper(int interfaceIndex) receiveSocket.ReceiveTimeout = 1000; receiveSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(multicastAddress, interfaceIndex)); - sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(interfaceIndex)); + // https://github.com/Microsoft/BashOnWindows/issues/990 + if (!PlatformDetection.IsWindowsSubsystemForLinux) + { + sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(interfaceIndex)); + } var receiveBuffer = new byte[1024]; var receiveTask = receiveSocket.ReceiveAsync(new ArraySegment(receiveBuffer), SocketFlags.None); @@ -166,7 +170,7 @@ public void MulticastInterface_Set_InvalidIndex_Throws() } [OuterLoop] // TODO: Issue #11345 - [Theory] + [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // In WSL, the connect() call fails immediately. [InlineData(false)] [InlineData(true)] public void FailedConnect_GetSocketOption_SocketOptionNameError(bool simpleGet) diff --git a/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs b/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs index 6a55fa55ef134..94c5f8ef6ccea 100644 --- a/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs +++ b/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs @@ -804,17 +804,17 @@ private void TestDivision() where T : struct }); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionByte() { TestDivisionByZeroException(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionSByte() { TestDivisionByZeroException(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionUInt16() { TestDivisionByZeroException(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionInt16() { TestDivisionByZeroException(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionInt32() { TestDivisionByZeroException(); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public void DivisionByZeroExceptionInt64() { TestDivisionByZeroException(); } private void TestDivisionByZeroException() where T : struct { diff --git a/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj b/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj index 59b0007b99380..b979411f4f841 100644 --- a/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj +++ b/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj @@ -39,6 +39,9 @@ + + Common\System\PlatformDetection.cs + diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/divide.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/divide.cs index e61277584c28b..cf095d840b3d0 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/divide.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/divide.cs @@ -60,7 +60,7 @@ public static void RunDivideOneLargeOneSmallBI() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivideOneLargeOneZeroBI() { byte[] tempByteArray1 = new byte[0]; @@ -80,7 +80,7 @@ public static void RunDivideOneLargeOneZeroBI() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivideOneSmallOneZeroBI() { byte[] tempByteArray1 = new byte[0]; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/divrem.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/divrem.cs index 9e697c410976e..a817680471883 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/divrem.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/divrem.cs @@ -60,7 +60,7 @@ public static void RunDivRem_OneSmallOneLargeBI() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivRem_OneLargeOne0BI() { byte[] tempByteArray1 = new byte[0]; @@ -80,7 +80,7 @@ public static void RunDivRem_OneLargeOne0BI() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivRem_OneSmallOne0BI() { byte[] tempByteArray1 = new byte[0]; @@ -115,7 +115,7 @@ public static void Boundary() VerifyDivRemString(Math.Pow(2, 33) + " 2 bDivRem"); } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivRemTests() { byte[] tempByteArray1 = new byte[0]; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/modpow.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/modpow.cs index 6f265030eabc4..a655d28e05116 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/modpow.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/modpow.cs @@ -33,7 +33,7 @@ public static void ModPowValidSmallNumbers() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void ModPowNegative() { byte[] tempByteArray1; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_divide.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_divide.cs index d79a34a99544d..2ec47f165fad1 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_divide.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_divide.cs @@ -46,7 +46,7 @@ public static void RunDividePositivenonZero() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunDivideNegative() { byte[] tempByteArray1 = new byte[0]; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_modulus.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_modulus.cs index c02aa3bf4a314..95c6503d990ef 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_modulus.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_modulus.cs @@ -47,7 +47,7 @@ public static void RunRemainderTestsPositive() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunRemainderNegative() { byte[] tempByteArray1 = new byte[0]; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/properties.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/properties.cs index 321ab30567555..7b31899ceeb91 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/properties.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/properties.cs @@ -12,7 +12,7 @@ public class propertiesTest private static int s_samples = 10; private static Random s_random = new Random(100); - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunZeroTests() { BigInteger bigInteger; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/remainder.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/remainder.cs index 72f7c685c4b81..c59969f47a900 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/remainder.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/remainder.cs @@ -47,7 +47,7 @@ public static void RunRemainderPositive() } } - [Fact] + [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/513 public static void RunRemainderNegative() { byte[] tempByteArray1 = new byte[0]; diff --git a/src/libraries/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj b/src/libraries/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj index 6d79f2b7ea241..f8a35cfe62ee3 100644 --- a/src/libraries/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj +++ b/src/libraries/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj @@ -78,6 +78,9 @@ + + Common\System\PlatformDetection.cs + \ No newline at end of file