diff --git a/src/libraries/Common/tests/TestUtilities/System/DisableParallelization.cs b/src/libraries/Common/tests/TestUtilities/System/DisableParallelization.cs new file mode 100644 index 00000000000000..5cbfa9cfc34315 --- /dev/null +++ b/src/libraries/Common/tests/TestUtilities/System/DisableParallelization.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Xunit; + +namespace System +{ + [CollectionDefinition(nameof(DisableParallelization), DisableParallelization = true)] + public class DisableParallelization { } +} diff --git a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj index ecb7f715559ff9..0387e7d6bf4953 100644 --- a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj +++ b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj @@ -18,6 +18,7 @@ + diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs index 03fc458176a10f..651a4858d498ae 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs @@ -9,11 +9,8 @@ namespace System.ComponentModel.Tests { - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - // Mutable static comparision in the implementation - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public class MemberDescriptorTests { [Theory] diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/ReflectionCachesUpdateHandlerTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/ReflectionCachesUpdateHandlerTests.cs index 84a7069bed6e35..2bf4e13a643c1e 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/ReflectionCachesUpdateHandlerTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/ReflectionCachesUpdateHandlerTests.cs @@ -7,7 +7,7 @@ namespace System.ComponentModel.Tests { [SimpleUpdateTest] - [Collection("NoParallelTests")] // Clears the cache which disrupts concurrent tests + [Collection(nameof(DisableParallelization))] // Clears the cache which disrupts concurrent tests public class ReflectionCachesUpdateHandlerTests { [Fact] diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs index d1754653b81c85..c14858258af065 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs @@ -10,7 +10,7 @@ namespace System.ComponentModel.Tests { - [Collection("NoParallelTests")] // manipulates cache + [Collection(nameof(DisableParallelization))] // manipulates cache public class TypeDescriptorTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT 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 100aa445578b53..1b343e595cc0bd 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs @@ -1086,7 +1086,7 @@ public void FileSystemWatcher_ModifyFiltersConcurrentWithEvents() } } - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public partial class DangerousFileSystemWatcherTests : FileSystemWatcherTest { private readonly ITestOutputHelper _output; diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs index c40dcc5d21bf8c..f1b14874a1c495 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs @@ -11,9 +11,6 @@ namespace System.IO.Tests { - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - public abstract partial class FileSystemWatcherTest : FileCleanupTestBase { // Events are reported asynchronously by the OS, so allow an amount of time for diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/FileStreamConformanceTests.Windows.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/FileStreamConformanceTests.Windows.cs index 3d3e2d0307a8f3..6e694e43473696 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/FileStreamConformanceTests.Windows.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/FileStreamConformanceTests.Windows.cs @@ -77,7 +77,7 @@ protected override string GetTestFilePath(int? index = null, [CallerMemberName] } [PlatformSpecific(TestPlatforms.Windows)] // the test setup is Windows-specifc - [Collection("NoParallelTests")] // don't run in parallel, as file sharing logic is not thread-safe + [Collection(nameof(DisableParallelization))] // don't run in parallel, as file sharing logic is not thread-safe [OuterLoop("Requires admin privileges to create a file share")] [ConditionalClass(typeof(UncFilePathFileStreamStandaloneConformanceTests), nameof(CanShareFiles))] public class UncFilePathFileStreamStandaloneConformanceTests : UnbufferedAsyncFileStreamStandaloneConformanceTests diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs index c4344de517449d..bbae2fbb0e240b 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests // Don't run in parallel as the WhenDiskIsFullTheErrorMessageContainsAllDetails test // consumes entire available free space on the disk (only on Linux, this is how posix_fallocate works) // and if we try to run other disk-writing test in the meantime we are going to get "No space left on device" exception. - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public partial class FileStream_ctor_options : FileStream_ctor_str_fm_fa_fs_buffer_fo { protected override string GetExpectedParamName(string paramName) => "value"; @@ -166,7 +166,4 @@ public void WhenDiskIsFullTheErrorMessageContainsAllDetails(FileMode mode) Assert.False(exists); } } - - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs index f28491882ac3db..6b0e8850549368 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs @@ -11,16 +11,11 @@ namespace System.Net.Http.Functional.Tests { - [CollectionDefinition(nameof(NonParallelTestCollection), DisableParallelization = true)] - public class NonParallelTestCollection - { - } - // This test class contains tests which are strongly timing-dependent. // There are two mitigations avoid flaky behavior on CI: // - Parallel test execution is disabled // - Using extreme parameters, and checks which are very unlikely to fail, if the implementation is correct - [Collection(nameof(NonParallelTestCollection))] + [Collection(nameof(DisableParallelization))] [ConditionalClass(typeof(SocketsHttpHandler_Http2FlowControl_Test), nameof(IsSupported))] public sealed class SocketsHttpHandler_Http2FlowControl_Test : HttpClientHandlerTestBase { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs index aad7f5d1a873dd..d760e8e9c53e95 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs @@ -13,7 +13,7 @@ namespace System.Net.Http.Functional.Tests { - [Collection(nameof(NonParallelTestCollection))] + [Collection(nameof(DisableParallelization))] [ConditionalClass(typeof(SocketsHttpHandler_Http2KeepAlivePing_Test), nameof(IsSupported))] public sealed class SocketsHttpHandler_Http2KeepAlivePing_Test : HttpClientHandlerTestBase { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 14f444b1935a60..e7ce1967052703 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -3143,7 +3143,7 @@ public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2(ITestOutputH } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_Http3_MsQuic : HttpClientHandlerTest_Http3 { public SocketsHttpHandlerTest_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3151,7 +3151,7 @@ public SocketsHttpHandlerTest_Http3_MsQuic(ITestOutputHelper output) : base(outp } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_Http3_Mock : HttpClientHandlerTest_Http3 { public SocketsHttpHandlerTest_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3159,7 +3159,7 @@ public SocketsHttpHandlerTest_Http3_Mock(ITestOutputHelper output) : base(output } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_MsQuic : HttpClientHandlerTest { public SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3168,7 +3168,7 @@ public SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_MsQuic(ITestOutputHelp } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_Mock : HttpClientHandlerTest { public SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3177,7 +3177,7 @@ public SocketsHttpHandlerTest_HttpClientHandlerTest_Http3_Mock(ITestOutputHelper } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_Cookies_Http3_MsQuic : HttpClientHandlerTest_Cookies { public SocketsHttpHandlerTest_Cookies_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3186,7 +3186,7 @@ public SocketsHttpHandlerTest_Cookies_Http3_MsQuic(ITestOutputHelper output) : b } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_Cookies_Http3_Mock : HttpClientHandlerTest_Cookies { public SocketsHttpHandlerTest_Cookies_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3195,7 +3195,7 @@ public SocketsHttpHandlerTest_Cookies_Http3_Mock(ITestOutputHelper output) : bas } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_MsQuic : HttpClientHandlerTest_Headers { public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3204,7 +3204,7 @@ public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_MsQuic(ITestOu } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_Mock : HttpClientHandlerTest_Headers { public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3213,7 +3213,7 @@ public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_Mock(ITestOutp } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_MsQuic : SocketsHttpHandler_Cancellation_Test { public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3222,7 +3222,7 @@ public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_MsQuic(ITest } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_Mock : SocketsHttpHandler_Cancellation_Test { public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3231,7 +3231,7 @@ public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3_Mock(ITestOu } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_MsQuic : HttpClientHandler_AltSvc_Test { public SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3240,7 +3240,7 @@ public SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_MsQuic(ITestOutput } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_Mock : HttpClientHandler_AltSvc_Test { public SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3249,7 +3249,7 @@ public SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3_Mock(ITestOutputHe } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMsQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_Finalization_Http3_MsQuic : HttpClientHandler_Finalization_Test { public SocketsHttpHandler_HttpClientHandler_Finalization_Http3_MsQuic(ITestOutputHelper output) : base(output) { } @@ -3258,7 +3258,7 @@ public SocketsHttpHandler_HttpClientHandler_Finalization_Http3_MsQuic(ITestOutpu } [ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsMockQuicSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class SocketsHttpHandler_HttpClientHandler_Finalization_Http3_Mock : HttpClientHandler_Finalization_Test { public SocketsHttpHandler_HttpClientHandler_Finalization_Http3_Mock(ITestOutputHelper output) : base(output) { } @@ -3266,10 +3266,6 @@ public SocketsHttpHandler_HttpClientHandler_Finalization_Http3_Mock(ITestOutputH protected override QuicImplementationProvider UseQuicImplementationProvider => QuicImplementationProviders.Mock; } - // Define test collection for tests to avoid all other tests. - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] public abstract class SocketsHttpHandler_RequestValidationTest { diff --git a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/LoggingTest.cs b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/LoggingTest.cs index 915067acffbbfc..c3333760a4d094 100644 --- a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/LoggingTest.cs +++ b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/LoggingTest.cs @@ -13,7 +13,7 @@ namespace System.Net.NameResolution.Tests { using Configuration = System.Net.Test.Common.Configuration; - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public class LoggingTest { [Fact] diff --git a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/TestSettings.cs b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/TestSettings.cs index 49c1b0a77304a8..f4b45bf18ac0ad 100644 --- a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/TestSettings.cs +++ b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/TestSettings.cs @@ -8,9 +8,6 @@ namespace System.Net.NameResolution.Tests { - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - internal static class TestSettings { // A hostname that will not exist in any DNS caches, forcing some I/O to lookup. diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index 40ed3bf3b46027..18d8b909af07de 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -20,7 +20,7 @@ namespace System.Net.Quic.Tests { [ConditionalClass(typeof(QuicTestBase), nameof(IsSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public class MsQuicTests : QuicTestBase { private static byte[] s_data = Encoding.UTF8.GetBytes("Hello world!"); diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamConnectedStreamConformanceTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamConnectedStreamConformanceTests.cs index cb31cfd850c74a..3b8d507afed1bc 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamConnectedStreamConformanceTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamConnectedStreamConformanceTests.cs @@ -21,7 +21,7 @@ public sealed class MockQuicStreamConformanceTests : QuicStreamConformanceTests } [ConditionalClass(typeof(QuicTestBase), nameof(QuicTestBase.IsSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class MsQuicQuicStreamConformanceTests : QuicStreamConformanceTests { protected override QuicImplementationProvider Provider => QuicImplementationProviders.MsQuic; diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs index 5fb1bc14aa8998..d2551ab89ac8ff 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs @@ -994,13 +994,9 @@ public QuicStreamTests_MockProvider(ITestOutputHelper output) : base(output) { } } [ConditionalClass(typeof(QuicTestBase), nameof(QuicTestBase.IsSupported))] - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public sealed class QuicStreamTests_MsQuicProvider : QuicStreamTests { public QuicStreamTests_MsQuicProvider(ITestOutputHelper output) : base(output) { } } - - // Define test collection for tests to avoid all other tests. - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs index 5f11eaa824e6e8..39506cee57fdaf 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs @@ -364,7 +364,7 @@ public async Task FailedConnect_ConnectedReturnsFalse() // The test class is declared non-parallel because of possible IPv4/IPv6 port-collision on Unix: // When running these tests in parallel with other tests, there is some chance that the DualMode client // will connect to an IPv4 server of a parallel test case. - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public abstract class Connect_NonParallel : SocketTestHelperBase where T : SocketHelperBase, new() { protected Connect_NonParallel(ITestOutputHelper output) : base(output) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisposedSocketTests.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisposedSocketTests.cs index c8394930b552a8..06d1ca4eb8c00e 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisposedSocketTests.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisposedSocketTests.cs @@ -764,7 +764,7 @@ private static void CreateSocketWithDanglingReference() } } - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public class DisposedSocketTestsNonParallel { [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs index 09f198cb500199..9fb542d8335e87 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs @@ -11,7 +11,7 @@ namespace System.Net.Sockets.Tests // When running in parallel with other tests, there is some chance that Accept() calls in LocalEndPointTest will // accept a connection request from another, DualMode client living in a parallel test // that is intended to connect to a server of opposite AddressFamily in the parallel test. - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public abstract class LocalEndPointTest : SocketTestHelperBase where T : SocketHelperBase, new() { protected abstract bool IPv6 { get; } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs index f85a9b0db3dedd..0b49749e09aeec 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs @@ -277,7 +277,7 @@ private static void DisposeSockets(IEnumerable> soc } } - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public class SelectTest_NonParallel { [OuterLoop] diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs index aa0d967e9f783d..35b427eaf32e89 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs @@ -467,7 +467,7 @@ public void EndSendFile_NullAsyncResult_Throws() // Running all cases of GreaterThan2GBFile_SendsAllBytes in parallel may attempt to allocate Min(ProcessorCount, Subclass_Count) * 2GB of disk space // in extreme cases. Some CI machines may run out of disk space if this happens. - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public abstract class SendFile_NonParallel : SocketTestHelperBase where T : SocketHelperBase, new() { protected SendFile_NonParallel(ITestOutputHelper output) : base(output) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceiveNonParallel.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceiveNonParallel.cs index 470472f226d4ec..97cad8577407b2 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceiveNonParallel.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceiveNonParallel.cs @@ -10,7 +10,7 @@ namespace System.Net.Sockets.Tests { - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public abstract class SendReceiveNonParallel : SocketTestHelperBase where T : SocketHelperBase, new() { public SendReceiveNonParallel(ITestOutputHelper output) : base(output) { } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs index 5073f60c3e6a12..0bf9bdd45688f4 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs @@ -690,9 +690,9 @@ public void SetUnsupportedRawSocketOption_DoesNotDisconnectSocket() private static int SOL_SOCKET = OperatingSystem.IsLinux() ? 1 : (int)SocketOptionLevel.Socket; } - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] // Set of tests to not run together with any other tests. - public partial class NoParallelTests + public class NoParallelTests { [Fact] public void BindDuringTcpWait_Succeeds() @@ -714,7 +714,7 @@ public void BindDuringTcpWait_Succeeds() } // Bind a socket to the same address we just used. - // To avoid conflict with other tests, this is part of the NoParallelTests test collection. + // To avoid conflict with other tests, this is part of the DisableParallelization test collection. using (Socket b = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { b.Bind(new IPEndPoint(IPAddress.Loopback, port)); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs index e3bfff0c187933..1922d37ec5cacb 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs @@ -11,10 +11,6 @@ namespace System.Net.Sockets.Tests { - // Define test collection for tests to avoid all other tests. - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - // Abstract base class for various different socket "modes" (sync, async, etc) // See SendReceive.cs for usage public abstract class SocketHelperBase diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs index 91e22728148109..a442af692e5a70 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs @@ -6,7 +6,7 @@ namespace System.Net.Sockets.Tests { - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public class TimeoutTest { [Fact] diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs index 3e240e65caabf8..c5b51d1f3dd4e1 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs @@ -14,7 +14,7 @@ namespace System.Reflection.Metadata /// script that applies one or more updates to Foo.dll The ApplyUpdateTest /// testsuite runs each test in sequence, loading the corresponding /// assembly, applying an update to it and observing the results. - [Collection(nameof(ApplyUpdateUtil.NoParallelTests))] + [Collection(nameof(DisableParallelization))] public class ApplyUpdateTest { [ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))] diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs index 36d04c42604cf8..beaa4a0e7338bb 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs @@ -12,9 +12,6 @@ public class ApplyUpdateUtil { internal const string DotNetModifiableAssembliesSwitch = "DOTNET_MODIFIABLE_ASSEMBLIES"; internal const string DotNetModifiableAssembliesValue = "debug"; - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public class NoParallelTests { } - /// Whether ApplyUpdate is supported by the environment, test configuration, and runtime. /// /// We need: diff --git a/src/libraries/System.Runtime/tests/Helpers.cs b/src/libraries/System.Runtime/tests/Helpers.cs index b44d82c5f1fb6c..5d44dc649976bf 100644 --- a/src/libraries/System.Runtime/tests/Helpers.cs +++ b/src/libraries/System.Runtime/tests/Helpers.cs @@ -10,9 +10,6 @@ namespace System.Tests { - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - public static class Helpers { private static Type s_refEmitType; diff --git a/src/libraries/System.Runtime/tests/System/ArrayTests.cs b/src/libraries/System.Runtime/tests/System/ArrayTests.cs index b7bdc5fab35834..e0108b81f3e57b 100644 --- a/src/libraries/System.Runtime/tests/System/ArrayTests.cs +++ b/src/libraries/System.Runtime/tests/System/ArrayTests.cs @@ -4736,7 +4736,7 @@ public enum Int32Enum public enum Int64Enum : long { } } - [Collection("NoParallelTests")] + [Collection(nameof(DisableParallelization))] public class DangerousArrayTests { [OuterLoop] // Allocates large array diff --git a/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs index e976da0384e7af..a74262a38d36cd 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs @@ -6,7 +6,7 @@ namespace System.Reflection.Tests { - [Collection(nameof(NoParallelTests))] + [Collection(nameof(DisableParallelization))] public class ReflectionCacheTests { [Fact]