From 668bc6a89dd06a4bf9794ca9e86beda02e08b845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 5 Jun 2020 13:10:46 +0200 Subject: [PATCH 1/2] Use ConditionalFact/Theory for skipping RemoteExecutor on unsupported platforms RemoteExecutor doesn't work on platforms that can't spawn processes like iOS/Android/WebAssembly. --- docs/project/writing-tests.md | 2 +- eng/Versions.props | 2 +- ...ientHandlerTest.DefaultProxyCredentials.cs | 2 +- .../Net/Http/HttpClientHandlerTest.Proxy.cs | 4 +- ...ttpClientHandlerTest.ServerCertificates.cs | 2 +- .../tests/FileSystemTests.cs | 5 +- .../tests/ProjectDataTests.cs | 2 +- .../tests/ArrayPool/CollectionTests.cs | 10 +- .../tests/ArrayPool/UnitTests.cs | 11 +- .../System/CodeDom/Compiler/ExecutorTests.cs | 10 +- .../tests/EtwTests.cs | 2 +- .../Composition/CompositionExceptionTests.cs | 2 +- .../tests/AsyncOperationFinalizerTests.cs | 4 +- .../System/Configuration/CustomHostTests.cs | 2 +- .../tests/CancelKeyPress.Unix.cs | 6 +- .../System.Console/tests/CancelKeyPress.cs | 2 +- .../tests/ConsoleEncoding.Windows.cs | 8 +- .../System.Console/tests/ConsoleEncoding.cs | 4 +- .../tests/NonStandardConfiguration.Unix.cs | 2 +- src/libraries/System.Console/tests/ReadKey.cs | 2 +- .../System.Console/tests/RedirectedStream.cs | 6 +- .../tests/WindowAndCursorProps.cs | 6 +- .../System/Data/DataCommonEventSourceTest.cs | 2 +- .../tests/ActivitySourceTests.cs | 18 +-- .../tests/ActivityTests.cs | 14 +- .../DiagnosticSourceEventSourceBridgeTests.cs | 26 ++-- .../tests/PerformanceDataTests.cs | 2 +- .../tests/ProcessCollectionTests.cs | 3 +- .../tests/ProcessStandardConsoleTests.cs | 3 +- .../tests/ProcessStartInfoTests.cs | 14 +- .../tests/ProcessStreamReadTests.cs | 34 ++--- .../tests/ProcessTestBase.NonUap.cs | 1 + .../tests/ProcessTests.Unix.cs | 40 +++--- .../tests/ProcessTests.cs | 123 +++++++++--------- .../tests/ProcessThreadTests.Unix.cs | 3 +- .../tests/ProcessThreadTests.cs | 7 +- .../tests/ProcessWaitingTests.cs | 44 +++---- .../tests/ConsoleTraceListenerTests.cs | 4 +- .../tests/DefaultTraceListenerClassTests.cs | 4 +- .../TestsManifestGeneration.Etw.cs | 8 +- .../System.Drawing.Common/tests/IconTests.cs | 4 +- .../tests/CultureInfo/CultureInfoAll.cs | 2 +- .../CultureInfo/CultureInfoCurrentCulture.cs | 8 +- .../System/Globalization/RegionInfoTests.cs | 2 +- .../tests/FileSystemWatcher.Unix.cs | 2 +- .../tests/Directory/CreateDirectory.cs | 2 +- .../Directory/GetFileSystemEntries_str.cs | 2 +- .../tests/Directory/SetCurrentDirectory.cs | 6 +- .../tests/FileInfo/Exists.cs | 4 +- .../tests/FileStream/Dispose.cs | 6 +- .../tests/FileStream/LockUnlock.cs | 4 +- .../tests/FileStream/ctor_str_fm_fa_fs.cs | 2 +- .../tests/MemoryMappedFile.CrossProcess.cs | 2 +- .../AnonymousPipeTest.CrossProcess.cs | 6 +- .../NamedPipeTest.CrossProcess.cs | 6 +- .../NamedPipeTest.CurrentUserOnly.Unix.cs | 2 +- .../NamedPipeTest.RunAsClient.Unix.cs | 7 +- .../System.Linq.Parallel/tests/EtwTests.cs | 2 +- .../tests/FunctionalTests/DiagnosticsTests.cs | 48 +++---- .../tests/FunctionalTests/HttpClientTest.cs | 4 +- .../FunctionalTests/SocketsHttpHandlerTest.cs | 2 +- .../Headers/CacheControlHeaderValueTest.cs | 2 +- .../UnitTests/HttpEnvironmentProxyTest.cs | 12 +- .../tests/UnitTests/HttpWindowsProxyTest.cs | 16 +-- .../tests/UnitTests/SystemProxyInfoTest.cs | 4 +- .../tests/Functional/LoggingTest.cs | 2 +- .../tests/FunctionalTests/PingTest.cs | 2 +- .../tests/FunctionalTests/LoggingTest.cs | 2 +- .../tests/AuthenticationManagerTest.cs | 8 +- .../tests/GlobalProxySelectionTest.cs | 2 +- .../tests/HttpWebRequestTest.cs | 12 +- .../tests/WebRequestTest.cs | 2 +- .../tests/FunctionalTests/LoggingTest.cs | 2 +- .../tests/ServicePointManagerTest.cs | 12 +- .../FunctionalTests/CreateSocketTests.cs | 2 +- .../tests/FunctionalTests/LoggingTest.cs | 2 +- .../tests/FunctionalTests/SendReceive.cs | 2 +- .../FunctionalTests/SocketDuplicationTests.cs | 4 +- .../tests/ResourceManagerTests.cs | 2 +- .../tests/System/AppDomainTests.cs | 66 +++++----- .../tests/System/Environment.Exit.cs | 2 +- .../System/Environment.GetCommandLineArgs.cs | 2 +- .../Environment.SetEnvironmentVariable.cs | 4 +- .../tests/System/EnvironmentTests.cs | 10 +- .../tests/System/IO/PathTests_Unix.cs | 2 +- .../tests/System/IO/PathTests_Windows.cs | 2 +- .../System/Runtime/ProfileOptimization.cs | 2 +- .../System/UnloadingAndProcessExitTests.cs | 2 +- .../tests/RuntimeIdentifierTests.cs | 6 +- .../tests/ContextualReflection.cs | 2 +- .../tests/BinaryFormatterTests.cs | 2 +- .../tests/System/ActivatorTests.cs | 2 +- .../DefaultValueAttributeTests.cs | 2 +- .../tests/System/ExitCodeTests.Unix.cs | 2 +- .../System.Runtime/tests/System/GCTests.cs | 34 ++--- .../System/Reflection/IsCollectibleTests.cs | 16 +-- .../HandleProcessCorruptedStateExceptions.cs | 2 +- .../tests/System/StringGetHashCodeTests.cs | 2 +- .../tests/System/TimeZoneInfoTests.cs | 4 +- .../tests/System/Type/TypeTests.cs | 6 +- .../tests/X509StoreTests.cs | 4 +- .../tests/EncoderFallbackBufferHelper.cs | 2 +- .../tests/Regex.Cache.Tests.cs | 10 +- .../tests/Regex.Ctor.Tests.cs | 6 +- .../tests/Regex.Match.Tests.cs | 6 +- .../tests/Dataflow/EtwTests.cs | 2 +- .../tests/AsyncValueTaskMethodBuilderTests.cs | 2 +- .../tests/EtwTests.cs | 2 +- .../AsyncTaskMethodBuilderTests.cs | 2 +- .../tests/ThreadTests.cs | 28 ++-- .../tests/ThreadPoolTests.cs | 4 +- .../tests/TimerMetricsTests.cs | 2 +- .../System.Threading/tests/EtwTests.cs | 2 +- .../tests/EventWaitHandleTests.cs | 2 +- .../System.Threading/tests/MutexTests.cs | 2 +- .../System.Threading/tests/SemaphoreTests.cs | 2 +- .../tests/AsyncTransactionScopeTests.cs | 2 +- 117 files changed, 465 insertions(+), 446 deletions(-) diff --git a/docs/project/writing-tests.md b/docs/project/writing-tests.md index 241a01512989e..f2984f020b7b0 100644 --- a/docs/project/writing-tests.md +++ b/docs/project/writing-tests.md @@ -17,7 +17,7 @@ using Microsoft.DotNet.RemoteExecutor; public class HttpWebRequestTest { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultMaximumResponseHeadersLength_SetAndGetLength_ValuesMatch() { RemoteExecutor.Invoke(() => diff --git a/eng/Versions.props b/eng/Versions.props index ee3b488470948..511607bdcb10e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -59,7 +59,7 @@ 5.0.0-beta.20280.1 2.5.1-beta.20280.1 5.0.0-beta.20280.1 - 5.0.0-beta.20280.1 + 5.0.0-beta.20304.3 5.0.0-beta.20280.1 5.0.0-preview.4.20202.18 diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.DefaultProxyCredentials.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.DefaultProxyCredentials.cs index dfc299c96bcbc..ccd32f66a6ad5 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.DefaultProxyCredentials.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.DefaultProxyCredentials.cs @@ -84,7 +84,7 @@ await server.AcceptConnectionSendResponseAndCloseAsync( [ActiveIssue("https://github.com/dotnet/runtime/issues/31380")] [OuterLoop("Uses external server")] [PlatformSpecific(TestPlatforms.AnyUnix)] // The default proxy is resolved via WinINet on Windows. - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public async Task ProxySetViaEnvironmentVariable_DefaultProxyCredentialsUsed(bool useProxy) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs index 8a30a894edf7a..83443ae607a44 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs @@ -113,10 +113,10 @@ await response.Content.ReadAsStringAsync(), } } - public static bool IsSocketsHttpHandler => !HttpClientHandlerTestBase.IsWinHttpHandler; + public static bool IsSocketsHttpHandlerAndRemoteExecutorSupported => !HttpClientHandlerTestBase.IsWinHttpHandler && RemoteExecutor.IsSupported; [OuterLoop("Uses external server")] - [ConditionalFact(nameof(IsSocketsHttpHandler))] + [ConditionalFact(nameof(IsSocketsHttpHandlerAndRemoteExecutorSupported))] public void Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy() { RemoteExecutor.Invoke(async (useVersionString) => diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index 5849f3c425497..85e33a9976759 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -409,7 +409,7 @@ public async Task PostAsync_Post_ChannelBinding_ConfiguredCorrectly() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Linux)] public void HttpClientUsesSslCertEnvironmentVariables() { diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs index 2b6db04eaf236..028f8b67feea3 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs @@ -41,7 +41,7 @@ public void ChDir() // public static void ChDrive(char Drive){ throw null; } // public static void ChDrive(string Drive){ throw null; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CloseAllFiles() { var fileName1 = GetTestFilePath(); @@ -574,7 +574,8 @@ public void Kill() // public static long Loc(int FileNumber) { throw null; } // Lock is supported on Windows only currently. - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows))] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [PlatformSpecific(TestPlatforms.Windows)] public void Lock_Unlock() { int fileNumber = FileSystem.FreeFile(); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ProjectDataTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ProjectDataTests.cs index 4a0f6fe53a0b5..3f46dd27a17ce 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ProjectDataTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ProjectDataTests.cs @@ -49,7 +49,7 @@ public void ClearProjectError() Assert.Equal(0, Information.Err().Erl); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EndApp() { RemoteExecutor.Invoke( diff --git a/src/libraries/System.Buffers/tests/ArrayPool/CollectionTests.cs b/src/libraries/System.Buffers/tests/ArrayPool/CollectionTests.cs index 35b61f2b59655..5f28fec6c2e87 100644 --- a/src/libraries/System.Buffers/tests/ArrayPool/CollectionTests.cs +++ b/src/libraries/System.Buffers/tests/ArrayPool/CollectionTests.cs @@ -16,7 +16,7 @@ namespace System.Buffers.ArrayPool.Tests public class CollectionTests : ArrayPoolTest { [OuterLoop("This is a long running test (over 2 minutes)")] - [Theory, + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported)), InlineData(true), InlineData(false)] public void BuffersAreCollectedWhenStale(bool trim) @@ -76,9 +76,11 @@ public void BuffersAreCollectedWhenStale(bool trim) }, trim, 3 * 60 * 1000); // This test has to wait for the buffers to go stale (give it three minutes) } + private static bool IsStressModeEnabledAndRemoteExecutorSupported => TestEnvironment.IsStressModeEnabled && RemoteExecutor.IsSupported; + // This test can cause problems for other tests run in parallel (from other assemblies) as // it pushes the physical memory usage above 80% temporarily. - [ConditionalTheory(typeof(TestEnvironment), nameof(TestEnvironment.IsStressModeEnabled)), + [ConditionalTheory(nameof(IsStressModeEnabledAndRemoteExecutorSupported)), InlineData(true), InlineData(false)] public unsafe void ThreadLocalIsCollectedUnderHighPressure(bool trim) @@ -140,7 +142,9 @@ private static bool ValidateTrimState(object pool, string trimString) return parsedTrim; } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + private static bool IsPreciseGcSupportedAndRemoteExecutorSupported => PlatformDetection.IsPreciseGcSupported && RemoteExecutor.IsSupported; + + [ConditionalTheory(nameof(IsPreciseGcSupportedAndRemoteExecutorSupported))] [InlineData(true)] [InlineData(false)] public void PollingEventFires(bool trim) diff --git a/src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs b/src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs index a9aa2ed581a41..baa80031d62eb 100644 --- a/src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs +++ b/src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Buffers.ArrayPool.Tests @@ -398,7 +399,7 @@ public static void RentingAfterPoolExhaustionReturnsSizeForCorrespondingBucket_A Assert.Equal(64, pool.Rent(63).Length); // still get original size } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void RentBufferFiresRentedDiagnosticEvent() { RemoteInvokeWithTrimming(() => @@ -418,7 +419,7 @@ public static void RentBufferFiresRentedDiagnosticEvent() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void ReturnBufferFiresDiagnosticEvent() { RemoteInvokeWithTrimming(() => @@ -435,7 +436,7 @@ public static void ReturnBufferFiresDiagnosticEvent() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent() { RemoteInvokeWithTrimming(() => @@ -445,7 +446,7 @@ public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent() { RemoteInvokeWithTrimming(() => @@ -455,7 +456,7 @@ public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void RentingManyBuffersFiresExpectedDiagnosticEvents() { RemoteInvokeWithTrimming(() => diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/ExecutorTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/ExecutorTests.cs index 8fdafcd194112..aaef873bb0786 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/ExecutorTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/ExecutorTests.cs @@ -34,7 +34,7 @@ public void NullTempFileCollection_Required_Throws() // for the tests if other tests run concurrently and launch child processes, as those child // processes may then extend the lifetime of the opened files, leading to sharing errors in tests. - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecWait_OutputCaptured() { RemoteExecutor.Invoke(() => @@ -49,7 +49,7 @@ public void ExecWait_OutputCaptured() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecWaitWithCapture_NullNames_OutputCaptured() { RemoteExecutor.Invoke(() => @@ -74,7 +74,7 @@ public void ExecWaitWithCapture_NullNames_OutputCaptured() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecWaitWithCapture_SpecifiedNames_OutputCaptured() { RemoteExecutor.Invoke(() => @@ -94,7 +94,7 @@ public void ExecWaitWithCapture_SpecifiedNames_OutputCaptured() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecWaitWithCapture_CurrentDirectorySpecified_OutputIncludesSpecifiedDirectory() { RemoteExecutor.Invoke(() => @@ -111,7 +111,7 @@ public void ExecWaitWithCapture_CurrentDirectorySpecified_OutputIncludesSpecifie }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecWaitWithCapture_OutputIncludesCurrentDirectory() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Collections.Concurrent/tests/EtwTests.cs b/src/libraries/System.Collections.Concurrent/tests/EtwTests.cs index 2b09763b48ee5..6b7d5f653ada5 100644 --- a/src/libraries/System.Collections.Concurrent/tests/EtwTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/EtwTests.cs @@ -12,7 +12,7 @@ namespace System.Collections.Concurrent.Tests { public class EtwTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestEtw() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs index 032baa1b24c5e..772e51763cfdc 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs @@ -368,7 +368,7 @@ public void Messsage_ShouldIncludeCountOfRootCauses() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Message_ShouldFormatCountOfRootCausesUsingTheCurrentCulture() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.ComponentModel.EventBasedAsync/tests/AsyncOperationFinalizerTests.cs b/src/libraries/System.ComponentModel.EventBasedAsync/tests/AsyncOperationFinalizerTests.cs index 35520383aed3a..e319dcf5d4c65 100644 --- a/src/libraries/System.ComponentModel.EventBasedAsync/tests/AsyncOperationFinalizerTests.cs +++ b/src/libraries/System.ComponentModel.EventBasedAsync/tests/AsyncOperationFinalizerTests.cs @@ -11,7 +11,7 @@ namespace System.ComponentModel.Tests { public class AsyncOperationFinalizerTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Finalizer_OperationCompleted_DoesNotCallOperationCompleted() { RemoteExecutor.Invoke(() => @@ -35,7 +35,7 @@ private void Completed() Assert.True(tracker.OperationDidComplete); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Finalizer_OperationNotCompleted_CompletesOperation() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs index 11d1adddaacb9..d04c63ea2cd97 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs @@ -14,7 +14,7 @@ namespace System.Configuration.Tests /// public class CustomHostTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Does not apply to .NET Framework.")] public void FilePathIsPopulatedCorrectly() { diff --git a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs index ab85a77880bab..1c190ce3ea465 100644 --- a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs +++ b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs @@ -12,7 +12,7 @@ public partial class CancelKeyPressTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/30130")] [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes public void HandlerInvokedForSigInt() @@ -20,7 +20,7 @@ public void HandlerInvokedForSigInt() HandlerInvokedForSignal(SIGINT); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/30130")] [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.OSX)] // Jenkins blocks SIGQUIT on OS X, causing the test to fail in CI public void HandlerInvokedForSigQuit() @@ -28,7 +28,7 @@ public void HandlerInvokedForSigQuit() HandlerInvokedForSignal(SIGQUIT); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/30130")] [PlatformSpecific(TestPlatforms.AnyUnix)] // events are triggered by Unix signals (SIGINT, SIGQUIT, SIGCHLD). public void ExitDetectionNotBlockedByHandler() diff --git a/src/libraries/System.Console/tests/CancelKeyPress.cs b/src/libraries/System.Console/tests/CancelKeyPress.cs index 56d1a237c41f1..30cbcb3a9403c 100644 --- a/src/libraries/System.Console/tests/CancelKeyPress.cs +++ b/src/libraries/System.Console/tests/CancelKeyPress.cs @@ -26,7 +26,7 @@ public static void CanAddAndRemoveHandler() Console.CancelKeyPress -= handler; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CanAddAndRemoveHandler_Remote() { // xunit registers a CancelKeyPress handler at the beginning of the test run and never diff --git a/src/libraries/System.Console/tests/ConsoleEncoding.Windows.cs b/src/libraries/System.Console/tests/ConsoleEncoding.Windows.cs index a1b55f657bc73..04d09e74196c6 100644 --- a/src/libraries/System.Console/tests/ConsoleEncoding.Windows.cs +++ b/src/libraries/System.Console/tests/ConsoleEncoding.Windows.cs @@ -10,7 +10,7 @@ public partial class ConsoleEncoding { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void InputEncoding_SetDefaultEncoding_Success() { @@ -23,7 +23,7 @@ public void InputEncoding_SetDefaultEncoding_Success() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void InputEncoding_SetUnicodeEncoding_SilentlyIgnoredInternally() { @@ -39,7 +39,7 @@ public void InputEncoding_SetUnicodeEncoding_SilentlyIgnoredInternally() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void OutputEncoding_SetDefaultEncoding_Success() { @@ -52,7 +52,7 @@ public void OutputEncoding_SetDefaultEncoding_Success() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void OutputEncoding_SetUnicodeEncoding_SilentlyIgnoredInternally() { diff --git a/src/libraries/System.Console/tests/ConsoleEncoding.cs b/src/libraries/System.Console/tests/ConsoleEncoding.cs index 1d316c4f69acd..78e08b6746ca4 100644 --- a/src/libraries/System.Console/tests/ConsoleEncoding.cs +++ b/src/libraries/System.Console/tests/ConsoleEncoding.cs @@ -115,7 +115,7 @@ public class NonexistentCodePageEncoding : Encoding public override int GetMaxCharCount(int byteCount) => 0; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void InputEncoding_SetWithInInitialized_ResetsIn() { RemoteExecutor.Invoke(() => @@ -155,7 +155,7 @@ public void InputEncoding_SetEncodingWithInvalidCodePage_ThrowsIOException() Assert.NotSame(invalidEncoding, Console.InputEncoding); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void OutputEncoding_SetWithErrorAndOutputInitialized_ResetsErrorAndOutput() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Console/tests/NonStandardConfiguration.Unix.cs b/src/libraries/System.Console/tests/NonStandardConfiguration.Unix.cs index aa9fd82a06acb..5e76d8fbfc2cd 100644 --- a/src/libraries/System.Console/tests/NonStandardConfiguration.Unix.cs +++ b/src/libraries/System.Console/tests/NonStandardConfiguration.Unix.cs @@ -12,7 +12,7 @@ namespace System.Tests public partial class NonStandardConfigurationTests { [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void NonBlockingStdout_AllDataReceived() { RemoteInvokeHandle remote = RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Console/tests/ReadKey.cs b/src/libraries/System.Console/tests/ReadKey.cs index 3e1445a3de9c1..c85e822b1bac0 100644 --- a/src/libraries/System.Console/tests/ReadKey.cs +++ b/src/libraries/System.Console/tests/ReadKey.cs @@ -23,7 +23,7 @@ public static void KeyAvailable() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void RedirectedConsole_ReadKey() { RunRemote(() => { Assert.Throws(() => Console.ReadKey()); return 42; }, new ProcessStartInfo() { RedirectStandardInput = true }); diff --git a/src/libraries/System.Console/tests/RedirectedStream.cs b/src/libraries/System.Console/tests/RedirectedStream.cs index 2208554e35ac6..985f67114f9e4 100644 --- a/src/libraries/System.Console/tests/RedirectedStream.cs +++ b/src/libraries/System.Console/tests/RedirectedStream.cs @@ -14,19 +14,19 @@ public class RedirectedStream { - [Fact] // the CI system redirects stdout, so we can only really test the redirected behavior. + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] // the CI system redirects stdout, so we can only really test the redirected behavior. public static void InputRedirect() { RunRemote(() => { Assert.True(Console.IsInputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardInput = true }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OutputRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsOutputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardOutput = true }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void ErrorRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsErrorRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardError = true }); diff --git a/src/libraries/System.Console/tests/WindowAndCursorProps.cs b/src/libraries/System.Console/tests/WindowAndCursorProps.cs index 44b5453a2ad65..8a02ffa777a80 100644 --- a/src/libraries/System.Console/tests/WindowAndCursorProps.cs +++ b/src/libraries/System.Console/tests/WindowAndCursorProps.cs @@ -197,7 +197,7 @@ public static void Title_GetUnix_ThrowPlatformNotSupportedException() Assert.Throws(() => Console.Title); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] // Expected behavior specific to Unix public static void Title_SetUnix_Success() { @@ -223,7 +223,9 @@ public static void Title_Get_Windows_NoNulls() Assert.Equal(trimmedTitle, title); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // Nano currently ignores set title + private static bool IsNotWindowsNanoServerAndRemoteExecutorSupported => PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported; + + [ConditionalTheory(nameof(IsNotWindowsNanoServerAndRemoteExecutorSupported))] // Nano currently ignores set title [ActiveIssue("https://github.com/dotnet/runtime/issues/34454", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [InlineData(0)] [InlineData(1)] diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs index 387de1151a557..869a001702457 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs @@ -11,7 +11,7 @@ namespace System.Data.Tests { public class DataCommonEventSourceTest { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void InvokeCodeThatShouldFirEvents_EnsureEventsFired() { diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs index 030e20d77a161..68de20b00173e 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs @@ -16,7 +16,7 @@ namespace System.Diagnostics.Tests { public class ActivitySourceTests : IDisposable { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestConstruction() { RemoteExecutor.Invoke(() => { @@ -32,7 +32,7 @@ public void TestConstruction() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestStartActivityWithNoListener() { RemoteExecutor.Invoke(() => { @@ -50,7 +50,7 @@ public void TestStartActivityWithNoListener() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestActivityWithListenerNoActivityCreate() { RemoteExecutor.Invoke(() => { @@ -72,7 +72,7 @@ public void TestActivityWithListenerNoActivityCreate() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestActivityWithListenerActivityCreateAndAllDataRequested() { RemoteExecutor.Invoke(() => { @@ -126,7 +126,7 @@ public void TestActivityWithListenerActivityCreateAndAllDataRequested() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestActivitySourceAttachedObject() { RemoteExecutor.Invoke(() => { @@ -152,7 +152,7 @@ public void TestActivitySourceAttachedObject() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestListeningToConstructedActivityEvents() { RemoteExecutor.Invoke(() => { @@ -198,7 +198,7 @@ public void TestListeningToConstructedActivityEvents() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestExpectedListenersReturnValues() { RemoteExecutor.Invoke(() => { @@ -298,7 +298,7 @@ public void TestExpectedListenersReturnValues() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestActivityCreationProperties() { RemoteExecutor.Invoke(() => { @@ -353,7 +353,7 @@ public void TestActivityCreationProperties() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestDefaultParentContext() { RemoteExecutor.Invoke(() => { diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs index 11dd57028538f..d79c701fe16fb 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs @@ -604,7 +604,7 @@ public void IdFormat_W3CWhenTraceIdAndSpanIdProvided() Assert.True(IdIsW3CFormat(activity.Id)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IdFormat_W3CWhenDefaultIsW3C() { RemoteExecutor.Invoke(() => @@ -617,7 +617,7 @@ public void IdFormat_W3CWhenDefaultIsW3C() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IdFormat_HierarchicalWhenDefaultIsW3CButHierarchicalParentId() { RemoteExecutor.Invoke(() => @@ -642,7 +642,7 @@ public void IdFormat_ZeroTraceIdAndSpanIdWithHierarchicalFormat() Assert.Equal("0000000000000000", activity.SpanId.ToHexString()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IdFormat_W3CWhenForcedAndHierarchicalParentId() { RemoteExecutor.Invoke(() => @@ -763,7 +763,7 @@ public void Options_W3CNonHexCharsNotSupportedAndDoesNotThrow() Assert.Equal(ActivityTraceFlags.None, activity.ActivityTraceFlags); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IdFormat_W3CForcedOverridesParentActivityIdFormat() { RemoteExecutor.Invoke(() => @@ -841,7 +841,7 @@ public void SetIdFormat_CanSetAndOverrideBeforeStart() Assert.Equal(ActivityIdFormat.W3C, activity.IdFormat); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetIdFormat_OverridesForcedW3C() { RemoteExecutor.Invoke(() => @@ -855,7 +855,7 @@ public void SetIdFormat_OverridesForcedW3C() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetIdFormat_OverridesForcedHierarchical() { RemoteExecutor.Invoke(() => @@ -936,7 +936,7 @@ public void TraceIdBeforeStart_FromInvalidTraceparentHeader() Assert.Equal("00000000000000000000000000000000", activity.TraceId.ToHexString()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TraceIdBeforeStart_NoParent() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs index 46978a958e65a..5c1d0c19513c3 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs @@ -35,7 +35,7 @@ static IDisposable RemoteExecutor.Invoke(Action a) /// Tests the basic functionality of turning on specific EventSources and specifying /// the events you want. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSpecificEvents() { RemoteExecutor.Invoke(() => @@ -119,7 +119,7 @@ public void TestSpecificEvents() /// /// Test that things work properly for Linux newline conventions. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void LinuxNewLineConventions() { RemoteExecutor.Invoke(() => @@ -178,7 +178,7 @@ public void LinuxNewLineConventions() /// /// Tests what happens when you wildcard the source name (empty string) /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWildCardSourceName() { RemoteExecutor.Invoke(() => @@ -242,7 +242,7 @@ public void TestWildCardSourceName() /// /// Tests what happens when you wildcard event name (but not the source name) /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWildCardEventName() { RemoteExecutor.Invoke(() => @@ -329,7 +329,7 @@ public void TestWildCardEventName() /// Basically strings get turned into empty strings and other nulls are typically /// ignored. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestNulls() { RemoteExecutor.Invoke(() => @@ -410,7 +410,7 @@ public void TestNulls() /// Tests the feature that suppresses the implicit inclusion of serialable properties /// of the payload object. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestNoImplicitTransforms() { RemoteExecutor.Invoke(() => @@ -443,7 +443,7 @@ public void TestNoImplicitTransforms() /// /// Tests what happens when wacky characters are used in property specs. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestBadProperties() { RemoteExecutor.Invoke(() => @@ -475,7 +475,7 @@ public void TestBadProperties() } // Tests that messages about DiagnosticSourceEventSource make it out. - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestMessages() { RemoteExecutor.Invoke(() => @@ -508,7 +508,7 @@ public void TestMessages() /// /// Tests the feature to send the messages as EventSource Activities. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestActivities() { RemoteExecutor.Invoke(() => @@ -581,7 +581,7 @@ public void TestActivities() /// /// Tests that keywords that define shortcuts work. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestShortcutKeywords() { RemoteExecutor.Invoke(() => @@ -703,7 +703,7 @@ public void TestShortcutKeywords() } [OuterLoop("Runs for several seconds")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Stress_WriteConcurrently_DoesntCrash() { const int StressTimeSeconds = 4; @@ -735,7 +735,7 @@ public void Stress_WriteConcurrently_DoesntCrash() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IndexGetters_DontThrow() { RemoteExecutor.Invoke(() => @@ -772,7 +772,7 @@ public void IndexGetters_DontThrow() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ActivityObjectsAreInspectable() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs index 27c8a08f39a41..dc8e3a65ce95a 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs +++ b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs @@ -19,7 +19,7 @@ public PerformanceDataTests(PerformanceDataTestsFixture fixture) } // We run the test only if the stress mode is enabled and the process is elvated. - private static bool IsRunnableEnvironnement => Helpers.IsElevatedAndCanWriteToPerfCounters && TestEnvironment.IsStressModeEnabled; + private static bool IsRunnableEnvironnement => Helpers.IsElevatedAndCanWriteToPerfCounters && TestEnvironment.IsStressModeEnabled && RemoteExecutor.IsSupported; /// /// This test was taken from System.Diagnostics.PerformanceData documentation https://msdn.microsoft.com/en-us/library/system.diagnostics.performancedata(v=vs.110).aspx diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessCollectionTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessCollectionTests.cs index 6c88759e33665..0f245968dac95 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessCollectionTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessCollectionTests.cs @@ -4,6 +4,7 @@ using System.Collections; using System.Linq; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Diagnostics.Tests @@ -58,7 +59,7 @@ public void TestModuleCollectionBehavior() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestThreadCollectionBehavior() { CreateDefaultProcess(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs index 95e46e1f885a9..704a4c886e3ec 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs @@ -5,6 +5,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Diagnostics.Tests @@ -13,7 +14,7 @@ public class ProcessStandardConsoleTests : ProcessTestBase { private const int s_ConsoleEncoding = 437; - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestChangesInConsoleEncoding() { Action run = expectedCodePage => diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index 3636f8ea3fd4e..d5b30b3579160 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -197,7 +197,7 @@ public void TestEnvironmentProperty() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSetEnvironmentOnChildProcess() { const string name = "b5a715d3-d74f-465d-abb7-2abe844750c9"; @@ -217,7 +217,7 @@ public void TestSetEnvironmentOnChildProcess() Assert.Equal(RemoteExecutor.SuccessExitCode, p.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestEnvironmentOfChildProcess() { const string ItemSeparator = "CAFF9451396B4EEF8A5155A15BDC2080"; // random string that shouldn't be in any env vars; used instead of newline to separate env var strings @@ -278,7 +278,7 @@ public void TestUseShellExecuteProperty_SetAndGet() Assert.False(psi.UseShellExecute); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(0)] [InlineData(1)] [InlineData(2)] @@ -310,7 +310,7 @@ public void TestArgumentsProperty() Assert.Equal("-arg3 -arg4", psi.Arguments); } - [Theory, InlineData(true), InlineData(false)] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported)), InlineData(true), InlineData(false)] public void TestCreateNoWindowProperty(bool value) { Process testProcess = CreateProcessLong(); @@ -329,7 +329,7 @@ public void TestCreateNoWindowProperty(bool value) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWorkingDirectoryPropertyDefaultCase() { CreateDefaultProcess(); @@ -338,7 +338,7 @@ public void TestWorkingDirectoryPropertyDefaultCase() Assert.Equal(string.Empty, _process.StartInfo.WorkingDirectory); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWorkingDirectoryPropertyInChildProcess() { string workingDirectory = string.IsNullOrEmpty(Environment.SystemDirectory) ? TestDirectory : Environment.SystemDirectory ; @@ -352,7 +352,7 @@ public void TestWorkingDirectoryPropertyInChildProcess() } [ActiveIssue("https://github.com/dotnet/runtime/issues/18978")] - [Fact, PlatformSpecific(TestPlatforms.Windows), OuterLoop] // Uses P/Invokes, Requires admin privileges + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported)), PlatformSpecific(TestPlatforms.Windows), OuterLoop] // Uses P/Invokes, Requires admin privileges public void TestUserCredentialsPropertiesOnWindows() { string username = "test", password = "PassWord123!!"; diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs index 0fb4160d7eacb..0f8f1173bc04e 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs @@ -17,7 +17,7 @@ namespace System.Diagnostics.Tests { public class ProcessStreamReadTests : ProcessTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSyncErrorStream() { Process p = CreateProcessPortable(RemotelyInvokable.ErrorProcessBody); @@ -29,7 +29,7 @@ public void TestSyncErrorStream() Assert.True(p.WaitForExit(WaitInMS)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestAsyncErrorStream() { for (int i = 0; i < 2; ++i) @@ -56,7 +56,7 @@ public void TestAsyncErrorStream() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSyncOutputStream() { Process p = CreateProcessPortable(RemotelyInvokable.StreamBody); @@ -67,7 +67,7 @@ public void TestSyncOutputStream() Assert.Equal(RemotelyInvokable.TestConsoleApp + " started" + Environment.NewLine + RemotelyInvokable.TestConsoleApp + " closed" + Environment.NewLine, s); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestAsyncOutputStream() { for (int i = 0; i < 2; ++i) @@ -93,7 +93,7 @@ public void TestAsyncOutputStream() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] async public Task TestAsyncOutputStream_CancelOutputRead() { // This test might have some false negatives due to possible race condition in System.Diagnostics.AsyncStreamReader.ReadBufferAsync @@ -176,7 +176,7 @@ async private Task TestAsyncOutputStream_CancelOutputRead_RemotelyInvokable } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] async public Task TestAsyncOutputStream_BeginCancelBeginOutputRead() { using (AnonymousPipeServerStream pipeWrite = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable)) @@ -315,7 +315,7 @@ async private Task WaitPipeSignal(PipeStream pipe, int millisecond) } [PlatformSpecific(~TestPlatforms.Windows)] // currently on Windows these operations async-over-sync on Windows - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task ReadAsync_OutputStreams_Cancel_RespondsQuickly() { Process p = CreateProcessLong(); @@ -350,7 +350,7 @@ public async Task ReadAsync_OutputStreams_Cancel_RespondsQuickly() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSyncStreams() { const string expected = "This string should come as output"; @@ -367,7 +367,7 @@ public void TestSyncStreams() p.WaitForExit(); // wait for event handlers to complete } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestEOFReceivedWhenStdInClosed() { // This is the test for the fix of https://github.com/dotnet/runtime/issues/19277. @@ -422,7 +422,7 @@ public void TestEOFReceivedWhenStdInClosed() p1.Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestAsyncHalfCharacterAtATime() { var receivedOutput = false; @@ -463,7 +463,7 @@ public void TestAsyncHalfCharacterAtATime() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestManyOutputLines() { const int ExpectedLineCount = 144; @@ -491,7 +491,7 @@ public void TestManyOutputLines() Assert.Equal(ExpectedLineCount + 1, totalLinesReceived); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [SkipOnCoreClr("Avoid asserts in FileStream.Read when concurrently disposed", ~RuntimeConfiguration.Release)] public void TestClosingStreamsAsyncDoesNotThrow() { @@ -510,7 +510,7 @@ public void TestClosingStreamsAsyncDoesNotThrow() RemotelyInvokable.FireClosedEvent(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestClosingStreamsUndefinedDoesNotThrow() { Process p = CreateProcessPortable(RemotelyInvokable.WriteLinesAfterClose); @@ -522,7 +522,7 @@ public void TestClosingStreamsUndefinedDoesNotThrow() RemotelyInvokable.FireClosedEvent(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestClosingSyncModeDoesNotCloseStreams() { Process p = CreateProcessPortable(RemotelyInvokable.WriteLinesAfterClose); @@ -541,7 +541,7 @@ public void TestClosingSyncModeDoesNotCloseStreams() error.ReadToEnd(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestStreamNegativeTests() { { @@ -590,7 +590,7 @@ public void TestStreamNegativeTests() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestCustomStandardInputEncoding() { var process = CreateProcessPortable(RemotelyInvokable.ReadLineWithCustomEncodingWriteLineWithUtf8, Encoding.UTF32.WebName); @@ -611,7 +611,7 @@ public void TestCustomStandardInputEncoding() Assert.Equal(RemotelyInvokable.SuccessExitCode, process.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestMismatchedStandardInputEncoding() { var process = CreateProcessPortable(RemotelyInvokable.ReadLineWithCustomEncodingWriteLineWithUtf8, Encoding.UTF32.WebName); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.NonUap.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.NonUap.cs index 4ebc3d88263e9..eb2330746cabf 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.NonUap.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.NonUap.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Reflection; using System.Threading; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Diagnostics.Tests diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 1944afa59968a..192cded2647ce 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -33,7 +33,7 @@ private void TestWindowApisUnix() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MainWindowHandle_GetUnix_ThrowsPlatformNotSupportedException() { CreateDefaultProcess(); @@ -186,7 +186,7 @@ public void ProcessNameMatchesScriptName() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Linux)] // s_allowedProgramsToRun is Linux specific public void ProcessStart_UseShellExecute_OnUnix_FallsBackWhenNotRealExecutable() { @@ -260,7 +260,7 @@ public void ProcessStart_UseShellExecute_OnUnix_Executable_PassesArguments() Assert.True(File.Exists(testFilePath)); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData((string)null, true)] [InlineData("", true)] [InlineData("open", true)] @@ -420,7 +420,7 @@ public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgumentAr } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] public void TestPriorityClassUnix() { @@ -447,7 +447,7 @@ public void TestPriorityClassUnix() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] public void TestBasePriorityOnUnix() { @@ -504,7 +504,7 @@ public void TestStartOnUnixWithBadFormat() Assert.NotEqual(0, e.NativeErrorCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestStartWithNonExistingUserThrows() { Process p = CreateProcessPortable(RemotelyInvokable.Dummy); @@ -512,7 +512,7 @@ public void TestStartWithNonExistingUserThrows() Assert.Throws(() => p.Start()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestExitCodeKilledChild() { using (Process p = CreateProcessLong()) @@ -548,7 +548,7 @@ private static int CheckUserAndGroupIds(string userId, string groupId, string gr return RemoteExecutor.SuccessExitCode; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/28922", TestPlatforms.AnyUnix)] public unsafe void TestCheckChildProcessUserAndGroupIds() { @@ -573,7 +573,7 @@ public unsafe void TestCheckChildProcessUserAndGroupIds() /// Tests when running as root and starting a new process as a normal user, /// the new process doesn't have elevated privileges. /// - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop("Needs sudo access")] [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] [InlineData(true)] @@ -649,7 +649,7 @@ private static string GetCurrentRealUserName() /// Tests whether child processes are reaped (cleaning up OS resources) /// when they terminate. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Linux)] // Test uses Linux specific '/proc' filesystem public async Task TestChildProcessCleanup() { @@ -665,7 +665,7 @@ public async Task TestChildProcessCleanup() /// Tests whether child processes are reaped (cleaning up OS resources) /// when they terminate after the Process was Disposed. /// - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false, false)] [InlineData(false, true)] [InlineData(true, false)] @@ -721,7 +721,7 @@ private static async Task TryWaitProcessReapedAsync(int pid, int timeoutMs /// /// Tests the ProcessWaitState reference count drops to zero. /// - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] // Test validates Unix implementation public async Task TestProcessWaitStateReferenceCount() { @@ -771,12 +771,14 @@ public async Task TestProcessWaitStateReferenceCount() } } + private static bool IsStressModeEnabledAndRemoteExecutorSupported => TestEnvironment.IsStressModeEnabled && RemoteExecutor.IsSupported; + /// /// Verifies a new Process instance can refer to a process with a recycled pid for which /// there is still an existing Process instance. Operations on the existing instance will /// throw since that process has exited. /// - [ConditionalFact(typeof(TestEnvironment), nameof(TestEnvironment.IsStressModeEnabled))] + [ConditionalFact(nameof(IsStressModeEnabledAndRemoteExecutorSupported))] public void TestProcessRecycledPid() { const int LinuxPidMaxDefault = 32768; @@ -810,7 +812,7 @@ public void TestProcessRecycledPid() Assert.True(foundRecycled); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true)] [InlineData(false)] public async Task Kill_ExitedNonChildProcess_DoesNotThrow(bool killTree) @@ -896,16 +898,6 @@ private static int GetWaitStateReferenceCount(object waitState) return (int)referenCountField.GetValue(waitState); } - private void RunTestAsSudo(Func testMethod, string arg) - { - RemoteInvokeOptions options = new RemoteInvokeOptions() - { - RunAsSudo = true - }; - using (RemoteInvokeHandle handle = RemoteExecutor.Invoke(testMethod, arg, options)) - { } - } - [DllImport("libc")] private static extern int chmod(string path, int mode); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 167776c769ee1..ab3e0c685a9a8 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -75,7 +75,7 @@ private void AssertNonZeroAllZeroDarwin(long value) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] // Expected behavior varies on Windows and Unix public void TestBasePriorityOnWindows() { @@ -102,7 +102,7 @@ public void TestBasePriorityOnWindows() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true)] [InlineData(false)] [InlineData(null)] @@ -252,8 +252,13 @@ public void ProcessStart_UseShellExecute_Executes(bool filenameAsUrl) } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsServerCore), - nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsIoTCore))] + private static bool UseShellExecuteExecuteOrderIsRunnablePlatform => + PlatformDetection.IsNotWindowsServerCore && + PlatformDetection.IsNotWindowsNanoServer && + PlatformDetection.IsNotWindowsIoTCore && + RemoteExecutor.IsSupported; + + [ConditionalFact(nameof(UseShellExecuteExecuteOrderIsRunnablePlatform))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void ProcessStart_UseShellExecute_ExecuteOrder() { @@ -318,7 +323,7 @@ public void ProcessStart_UseShellExecute_WorkingDirectory() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestExitCode() { { @@ -335,7 +340,7 @@ public void TestExitCode() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestExitTime() { // Try twice, since it's possible that the system clock could be adjusted backwards between when we snapshot it @@ -368,7 +373,7 @@ public void StartTime_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.StartTime); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestId() { CreateDefaultProcess(); @@ -384,7 +389,7 @@ public void TestId() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestHasExited() { { @@ -425,7 +430,7 @@ public void Kill_NotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.Kill()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestMachineName() { CreateDefaultProcess(); @@ -457,7 +462,7 @@ public void TestMainModule() Assert.Equal(normalize(string.Format("System.Diagnostics.ProcessModule ({0})", RemoteExecutor.HostRunnerName)), normalize(p.MainModule.ToString())); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestMaxWorkingSet() { CreateDefaultProcess(); @@ -512,7 +517,7 @@ public void MaxValueWorkingSet_GetSetMacos_ThrowsPlatformSupportedException() Assert.Throws(() => process.MaxWorkingSet = (IntPtr)1); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestMinWorkingSet() { CreateDefaultProcess(); @@ -584,7 +589,7 @@ public void TestModules() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestNonpagedSystemMemorySize64() { CreateDefaultProcess(); @@ -599,7 +604,7 @@ public void NonpagedSystemMemorySize64_GetNotStarted_ThrowsInvalidOperationExcep Assert.Throws(() => process.NonpagedSystemMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPagedMemorySize64() { CreateDefaultProcess(); @@ -614,7 +619,7 @@ public void PagedMemorySize64_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.PagedMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPagedSystemMemorySize64() { CreateDefaultProcess(); @@ -629,7 +634,7 @@ public void PagedSystemMemorySize64_GetNotStarted_ThrowsInvalidOperationExceptio Assert.Throws(() => process.PagedSystemMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakPagedMemorySize64() { CreateDefaultProcess(); @@ -644,7 +649,7 @@ public void PeakPagedMemorySize64_GetNotStarted_ThrowsInvalidOperationException( Assert.Throws(() => process.PeakPagedMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakVirtualMemorySize64() { CreateDefaultProcess(); @@ -659,7 +664,7 @@ public void PeakVirtualMemorySize64_GetNotStarted_ThrowsInvalidOperationExceptio Assert.Throws(() => process.PeakVirtualMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakWorkingSet64() { CreateDefaultProcess(); @@ -674,7 +679,7 @@ public void PeakWorkingSet64_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.PeakWorkingSet64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPrivateMemorySize64() { CreateDefaultProcess(); @@ -689,7 +694,7 @@ public void PrivateMemorySize64_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.PrivateMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestVirtualMemorySize64() { CreateDefaultProcess(); @@ -704,7 +709,7 @@ public void VirtualMemorySize64_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.VirtualMemorySize64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWorkingSet64() { CreateDefaultProcess(); @@ -726,7 +731,7 @@ public void WorkingSet64_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.WorkingSet64); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestProcessorTime() { CreateDefaultProcess(); @@ -748,7 +753,7 @@ public void TestProcessorTime() Assert.InRange(processorTimeAtHalfSpin, processorTimeBeforeSpin, Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TotalProcessorTime_PerformLoop_TotalProcessorTimeValid() { CreateDefaultProcess(); @@ -795,7 +800,7 @@ public void TotalProcessorTime_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.TotalProcessorTime); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestProcessStartTime() { TimeSpan allowedWindow = TimeSpan.FromSeconds(3); @@ -828,7 +833,7 @@ public void TestProcessStartTime() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ProcessStartTime_Deterministic_Across_Instances() { CreateDefaultProcess(); @@ -848,7 +853,7 @@ public void ExitTime_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.ExitTime); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(~(TestPlatforms.OSX | TestPlatforms.FreeBSD))] // getting/setting affinity not supported on OSX and BSD public void TestProcessorAffinity() { @@ -867,7 +872,7 @@ public void TestProcessorAffinity() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPriorityBoostEnabled() { CreateDefaultProcess(); @@ -896,7 +901,7 @@ public void PriorityBoostEnabled_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.PriorityBoostEnabled = true); } - [Fact, PlatformSpecific(TestPlatforms.Windows)] // Expected behavior varies on Windows and Unix + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported)), PlatformSpecific(TestPlatforms.Windows)] // Expected behavior varies on Windows and Unix public void TestPriorityClassWindows() { CreateDefaultProcess(); @@ -932,7 +937,7 @@ public void PriorityClass_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.PriorityClass); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestProcessName() { CreateDefaultProcess(); @@ -949,7 +954,7 @@ public void ProcessName_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.ProcessName); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSafeHandle() { CreateDefaultProcess(); @@ -957,7 +962,7 @@ public void TestSafeHandle() Assert.False(_process.SafeHandle.IsInvalid); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public void Handle_CreateEvent_BlocksUntilProcessCompleted(bool useSafeHandle) @@ -982,7 +987,7 @@ public void SafeHandle_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.SafeHandle); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestSessionId() { CreateDefaultProcess(); @@ -1020,7 +1025,7 @@ public void TestGetCurrentProcess() Assert.Equal(currentProcessId, current.Id); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestGetProcessById() { CreateDefaultProcess(); @@ -1229,7 +1234,7 @@ void TestRemoteProccess(Process remoteProcess) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void StartInfo_GetFileName_ReturnsExpected() { Process process = CreateProcessLong(); @@ -1241,7 +1246,7 @@ public void StartInfo_GetFileName_ReturnsExpected() Assert.True(process.WaitForExit(WaitInMS)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void StartInfo_SetOnRunningProcess_ThrowsInvalidOperationException() { Process process = CreateProcessLong(); @@ -1281,7 +1286,7 @@ public void StartInfo_GetOnRunningProcess_ThrowsInvalidOperationException() Assert.Throws(() => process.StartInfo); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(@"""abc"" d e", @"abc,d,e")] [InlineData(@"""abc"" d e", @"abc,d,e")] [InlineData("\"abc\"\t\td\te", @"abc,d,e")] @@ -1396,7 +1401,7 @@ public void Start_HasStandardErrorEncodingNonRedirected_ThrowsInvalidOperationEx Assert.Throws(() => process.Start()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Start_RedirectStandardOutput_StartAgain_DoesntThrow() { using (Process process = CreateProcess(() => @@ -1448,7 +1453,7 @@ public void TestHandleCount_OSX() } [OuterLoop] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Linux | TestPlatforms.Windows)] // Expected process HandleCounts differs on OSX public void HandleCountChanges() { @@ -1500,7 +1505,7 @@ public void HandleCount_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.HandleCount); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] // MainWindowHandle is not supported on Unix. public void MainWindowHandle_NoWindow_ReturnsEmptyHandle() { @@ -1552,7 +1557,7 @@ public void MainWindowHandle_GetWithGui_ShouldRefresh_Windows() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MainWindowTitle_NoWindow_ReturnsEmpty() { CreateDefaultProcess(); @@ -1569,7 +1574,7 @@ public void MainWindowTitle_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.MainWindowTitle); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CloseMainWindow_NoWindow_ReturnsFalse() { CreateDefaultProcess(); @@ -1614,7 +1619,7 @@ public void Responding_GetNotStarted_ThrowsInvalidOperationException() Assert.Throws(() => process.Responding); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestNonpagedSystemMemorySize() { CreateDefaultProcess(); @@ -1633,7 +1638,7 @@ public void NonpagedSystemMemorySize_GetNotStarted_ThrowsInvalidOperationExcepti #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPagedMemorySize() { CreateDefaultProcess(); @@ -1652,7 +1657,7 @@ public void PagedMemorySize_GetNotStarted_ThrowsInvalidOperationException() #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPagedSystemMemorySize() { CreateDefaultProcess(); @@ -1671,7 +1676,7 @@ public void PagedSystemMemorySize_GetNotStarted_ThrowsInvalidOperationException( #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakPagedMemorySize() { CreateDefaultProcess(); @@ -1690,7 +1695,7 @@ public void PeakPagedMemorySize_GetNotStarted_ThrowsInvalidOperationException() #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakVirtualMemorySize() { CreateDefaultProcess(); @@ -1709,7 +1714,7 @@ public void PeakVirtualMemorySize_GetNotStarted_ThrowsInvalidOperationException( #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPeakWorkingSet() { CreateDefaultProcess(); @@ -1728,7 +1733,7 @@ public void PeakWorkingSet_GetNotStarted_ThrowsInvalidOperationException() #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPrivateMemorySize() { CreateDefaultProcess(); @@ -1747,7 +1752,7 @@ public void PrivateMemorySize_GetNotStarted_ThrowsInvalidOperationException() #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestVirtualMemorySize() { CreateDefaultProcess(); @@ -1766,7 +1771,7 @@ public void VirtualMemorySize_GetNotStarted_ThrowsInvalidOperationException() #pragma warning restore 0618 } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestWorkingSet() { CreateDefaultProcess(); @@ -1872,7 +1877,7 @@ public void Process_StartWithDuplicatePassword() AssertExtensions.Throws(null, () => process.Start()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestLongProcessIsWorking() { // Sanity check for CreateProcessLong @@ -1939,7 +1944,7 @@ public void Start_HasStandardInputEncodingNonRedirected_ThrowsInvalidOperationEx Assert.Throws(() => process.Start()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Start_StandardInputEncodingPropagatesToStreamWriter() { var process = CreateProcessPortable(RemotelyInvokable.Dummy); @@ -1951,7 +1956,7 @@ public void Start_StandardInputEncodingPropagatesToStreamWriter() Assert.Same(encoding, process.StandardInput.Encoding); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void StartProcessWithArgumentList() { @@ -1975,7 +1980,7 @@ public void StartProcessWithArgumentList() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void StartProcessWithSameArgumentList() { @@ -2006,7 +2011,7 @@ public void StartProcessWithSameArgumentList() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void BothArgumentCtorAndArgumentListSet() { ProcessStartInfo psi = new ProcessStartInfo(GetCurrentProcessName(), "arg3"); @@ -2018,7 +2023,7 @@ public void BothArgumentCtorAndArgumentListSet() Assert.Throws(() => testProcess.Start()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void BothArgumentSetAndArgumentListSet() { ProcessStartInfo psi = new ProcessStartInfo(GetCurrentProcessName()); @@ -2067,7 +2072,7 @@ public void Kill_EntireProcessTree_True_CalledOnCallingProcess_ThrowsInvalidOper Assert.Throws(() => process.Kill(entireProcessTree: true)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Kill_EntireProcessTree_True_CalledOnTreeContainingCallingProcess_ThrowsInvalidOperationException() { Process containingProcess = CreateProcess(() => @@ -2111,7 +2116,7 @@ int RunProcessAttemptingToKillEntireTreeOnParent() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true)] [InlineData(false)] public void Kill_ExitedChildProcess_DoesNotThrow(bool killTree) @@ -2124,7 +2129,7 @@ public void Kill_ExitedChildProcess_DoesNotThrow(bool killTree) process.Kill(killTree); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task Kill_EntireProcessTree_False_OnlyRootProcessTerminated() { IReadOnlyList tree = CreateProcessTree(); @@ -2157,7 +2162,7 @@ await Helpers.RetryWithBackoff(() => } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task Kill_EntireProcessTree_True_EntireTreeTerminated() { IReadOnlyList tree = CreateProcessTree(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.Unix.cs index 9869514d85dff..b30ec811b1be9 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.Unix.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.Runtime.InteropServices; using System.Threading; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Diagnostics.Tests @@ -12,7 +13,7 @@ namespace System.Diagnostics.Tests public partial class ProcessThreadTests { [PlatformSpecific(TestPlatforms.AnyUnix)] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestPriorityLevelProperty_Unix() { CreateDefaultProcess(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs index 17ec64a5004f8..70de0c9448d5d 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Linq; +using Microsoft.DotNet.RemoteExecutor; using Xunit; using System.Threading.Tasks; @@ -13,7 +14,7 @@ namespace System.Diagnostics.Tests { public partial class ProcessThreadTests : ProcessTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestCommonPriorityAndTimeProperties() { CreateDefaultProcess(); @@ -156,7 +157,7 @@ public void TestStartAddressProperty() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestThreadStateProperty() { CreateDefaultProcess(); @@ -168,7 +169,7 @@ public void TestThreadStateProperty() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Threads_GetMultipleTimes_ReturnsSameInstance() { CreateDefaultProcess(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessWaitingTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessWaitingTests.cs index 658ed49147cd8..e9887892445e2 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessWaitingTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessWaitingTests.cs @@ -13,7 +13,7 @@ namespace System.Diagnostics.Tests { public class ProcessWaitingTests : ProcessTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MultipleProcesses_StartAllKillAllWaitAll() { const int Iters = 10; @@ -24,7 +24,7 @@ public void MultipleProcesses_StartAllKillAllWaitAll() foreach (Process p in processes) Assert.True(p.WaitForExit(WaitInMS)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task MultipleProcesses_StartAllKillAllWaitAllAsync() { const int Iters = 10; @@ -42,7 +42,7 @@ public async Task MultipleProcesses_StartAllKillAllWaitAllAsync() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MultipleProcesses_SerialStartKillWait() { const int Iters = 10; @@ -55,7 +55,7 @@ public void MultipleProcesses_SerialStartKillWait() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task MultipleProcesses_SerialStartKillWaitAsync() { const int Iters = 10; @@ -72,7 +72,7 @@ public async Task MultipleProcesses_SerialStartKillWaitAsync() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MultipleProcesses_ParallelStartKillWait() { const int Tasks = 4, ItersPerTask = 10; @@ -89,7 +89,7 @@ public void MultipleProcesses_ParallelStartKillWait() Task.WaitAll(Enumerable.Range(0, Tasks).Select(_ => Task.Run(work)).ToArray()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task MultipleProcesses_ParallelStartKillWaitAsync() { const int Tasks = 4, ItersPerTask = 10; @@ -134,7 +134,7 @@ public async Task CurrentProcess_WaitAsyncNeverCompletes(int milliseconds) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SingleProcess_TryWaitMultipleTimesBeforeCompleting() { Process p = CreateProcessLong(); @@ -154,7 +154,7 @@ public void SingleProcess_TryWaitMultipleTimesBeforeCompleting() Assert.True(p.WaitForExit(0)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task SingleProcess_TryWaitAsyncMultipleTimesBeforeCompleting() { Process p = CreateProcessLong(); @@ -208,7 +208,7 @@ public async Task SingleProcess_TryWaitAsyncMultipleTimesBeforeCompleting() Assert.Equal(TaskStatus.RanToCompletion, task.Status); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public async Task SingleProcess_WaitAfterExited(bool addHandlerBeforeStart) @@ -234,7 +234,7 @@ public async Task SingleProcess_WaitAfterExited(bool addHandlerBeforeStart) p.WaitForExit(); // wait for event handlers to complete } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public async Task SingleProcess_WaitAsyncAfterExited(bool addHandlerBeforeStart) @@ -266,7 +266,7 @@ public async Task SingleProcess_WaitAsyncAfterExited(bool addHandlerBeforeStart) Assert.True(p.HasExited); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(0)] [InlineData(1)] [InlineData(127)] @@ -284,7 +284,7 @@ public async Task SingleProcess_EnableRaisingEvents_CorrectExitCode(int exitCode } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SingleProcess_CopiesShareExitInformation() { Process p = CreateProcessLong(); @@ -302,7 +302,7 @@ public void SingleProcess_CopiesShareExitInformation() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task SingleProcess_CopiesShareExitAsyncInformation() { using Process p = CreateProcessLong(); @@ -336,7 +336,7 @@ public async Task SingleProcess_CopiesShareExitAsyncInformation() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void WaitForPeerProcess() { Process child1 = CreateProcessLong(); @@ -362,7 +362,7 @@ public void WaitForPeerProcess() Assert.Equal(RemoteExecutor.SuccessExitCode, child2.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task WaitAsyncForPeerProcess() { using Process child1 = CreateProcessLong(); @@ -400,7 +400,7 @@ public async Task WaitAsyncForPeerProcess() Assert.Equal(RemoteExecutor.SuccessExitCode, child2.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void WaitForSignal() { const string ExpectedSignal = "Signal"; @@ -446,7 +446,7 @@ public void WaitForSignal() Assert.Equal(RemotelyInvokable.SuccessExitCode, p.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task WaitAsyncForSignal() { const string expectedSignal = "Signal"; @@ -495,7 +495,7 @@ public async Task WaitAsyncForSignal() Assert.Equal(RemotelyInvokable.SuccessExitCode, p.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void WaitChain() { Process root = CreateProcess(() => @@ -522,7 +522,7 @@ public void WaitChain() Assert.Equal(RemoteExecutor.SuccessExitCode, root.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task WaitAsyncChain() { Process root = CreateProcess(async () => @@ -568,7 +568,7 @@ public async Task WaitAsyncChain() Assert.Equal(RemoteExecutor.SuccessExitCode, root.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void WaitForSelfTerminatingChild() { Process child = CreateProcessPortable(RemotelyInvokable.SelfTerminate); @@ -577,7 +577,7 @@ public void WaitForSelfTerminatingChild() Assert.NotEqual(RemoteExecutor.SuccessExitCode, child.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task WaitAsyncForSelfTerminatingChild() { Process child = CreateProcessPortable(RemotelyInvokable.SelfTerminate); @@ -590,7 +590,7 @@ public async Task WaitAsyncForSelfTerminatingChild() Assert.NotEqual(RemoteExecutor.SuccessExitCode, child.ExitCode); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task WaitAsyncForProcess() { Process p = CreateSleepProcess(WaitInMS); diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/ConsoleTraceListenerTests.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/ConsoleTraceListenerTests.cs index f7bd9d6a9a70a..55701cc2594d8 100644 --- a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/ConsoleTraceListenerTests.cs +++ b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/ConsoleTraceListenerTests.cs @@ -38,7 +38,7 @@ public static void NopClose() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public static void WriteExpectedOutput(bool value) @@ -65,7 +65,7 @@ public static void WriteExpectedOutput(bool value) }, value.ToString()).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public static void WriteLineExpectedOutput(bool value) diff --git a/src/libraries/System.Diagnostics.TraceSource/tests/DefaultTraceListenerClassTests.cs b/src/libraries/System.Diagnostics.TraceSource/tests/DefaultTraceListenerClassTests.cs index 8c8be77061271..6dbdc391f18c0 100644 --- a/src/libraries/System.Diagnostics.TraceSource/tests/DefaultTraceListenerClassTests.cs +++ b/src/libraries/System.Diagnostics.TraceSource/tests/DefaultTraceListenerClassTests.cs @@ -143,7 +143,7 @@ public void LogFileNamePropertyTest(string expectedLogFileName) Assert.Equal(expectedLogFileName, listener.LogFileName); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EntryAssemblyName_Default_IncludedInTrace() { RemoteExecutor.Invoke(() => @@ -155,7 +155,7 @@ public void EntryAssemblyName_Default_IncludedInTrace() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EntryAssemblyName_Null_NotIncludedInTrace() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs index 98557624196f8..f6ed6f79df2c4 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs @@ -28,11 +28,11 @@ public partial class TestsManifestGeneration // Specifies whether the process is elevated or not. private static readonly Lazy s_isElevated = new Lazy(AdminHelpers.IsProcessElevated); private static bool IsProcessElevated => s_isElevated.Value; - private static bool IsProcessElevatedAndNotWindowsNanoServer => - IsProcessElevated && PlatformDetection.IsNotWindowsNanoServer; + private static bool IsProcessElevatedAndNotWindowsNanoServerAndRemoteExecutorSupported => + IsProcessElevated && PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported; /// ETW only works with elevated process - [ConditionalFact(nameof(IsProcessElevatedAndNotWindowsNanoServer))] + [ConditionalFact(nameof(IsProcessElevatedAndNotWindowsNanoServerAndRemoteExecutorSupported))] public void Test_EventSource_EtwManifestGeneration() { RemoteExecutor.Invoke(() => @@ -63,7 +63,7 @@ public void Test_EventSource_EtwManifestGeneration() }).Dispose(); } - [ConditionalFact(nameof(IsProcessElevatedAndNotWindowsNanoServer))] + [ConditionalFact(nameof(IsProcessElevatedAndNotWindowsNanoServerAndRemoteExecutorSupported))] public void Test_EventSource_EtwManifestGenerationRollover() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Drawing.Common/tests/IconTests.cs b/src/libraries/System.Drawing.Common/tests/IconTests.cs index 25b8c5b9631e6..8389741be2916 100644 --- a/src/libraries/System.Drawing.Common/tests/IconTests.cs +++ b/src/libraries/System.Drawing.Common/tests/IconTests.cs @@ -617,7 +617,7 @@ void VerifyPng() } } - if (!AppContext.TryGetSwitch(DontSupportPngFramesInIcons, out bool isEnabled) || isEnabled) + if (RemoteExecutor.IsSupported && (!AppContext.TryGetSwitch(DontSupportPngFramesInIcons, out bool isEnabled) || isEnabled)) { RemoteExecutor.Invoke(() => { @@ -643,7 +643,7 @@ void VerifyPngNotSupported() } } - if (!AppContext.TryGetSwitch(DontSupportPngFramesInIcons, out bool isEnabled) || !isEnabled) + if (RemoteExecutor.IsSupported && (!AppContext.TryGetSwitch(DontSupportPngFramesInIcons, out bool isEnabled) || !isEnabled)) { RemoteExecutor.Invoke(() => { diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs index cf40173884bd6..de0f176e8eb25 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs @@ -629,7 +629,7 @@ public void GetCulturesTest(string cultureName, int lcid, string specificCulture Assert.True(found, $"Expected to find the culture {cultureName} in the enumerated list"); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ClearCachedDataTest() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs index ceb81b313ec53..5136ac9e436f7 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs @@ -54,7 +54,7 @@ public void CurrentUICulture() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultThreadCurrentCulture() { RemoteExecutor.Invoke(() => @@ -71,7 +71,7 @@ public void DefaultThreadCurrentCulture() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultThreadCurrentUICulture() { RemoteExecutor.Invoke(() => @@ -95,7 +95,7 @@ public void CurrentUICulture_Set_Null_ThrowsArgumentNullException() } [PlatformSpecific(TestPlatforms.AnyUnix)] // Windows locale support doesn't rely on LANG variable - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("en-US.UTF-8", "en-US")] [InlineData("en-US", "en-US")] [InlineData("en_GB", "en-GB")] @@ -121,7 +121,7 @@ public void CurrentCulture_BasedOnLangEnvVar(string langEnvVar, string expectedC } [PlatformSpecific(TestPlatforms.AnyUnix)] // When LANG is empty or unset, should default to the invariant culture on Unix. - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("")] [InlineData(null)] public void CurrentCulture_DefaultWithNoLang(string langEnvVar) diff --git a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs index be61f291aa8ee..e96e1e071cc0d 100644 --- a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs +++ b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs @@ -64,7 +64,7 @@ public void CurrentRegion_Unix() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void CurrentRegion_Windows() { diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Unix.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Unix.cs index 9d9ed743e0f72..c4e6d98d9d49a 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Unix.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Unix.cs @@ -18,7 +18,7 @@ namespace System.IO.Tests { public partial class DangerousFileSystemWatcherTests { - [ConditionalFact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop("Slow test with significant resource usage.")] public void FileSystemWatcher_Unix_DoesNotLeak() { diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs index cf453204b1638..a1f3afe4e5126 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs @@ -25,7 +25,7 @@ public virtual DirectoryInfo Create(string path) #region UniversalTests - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FileNameIsToString_NotFullPath() { // We're checking that we're maintaining the original path diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs b/src/libraries/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs index a84f023b48425..bd96b894e3467 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs @@ -295,7 +295,7 @@ public void UnixValidCharsDirectoryPath(string valid) public sealed class Directory_GetEntries_CurrentDirectory : FileCleanupTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CurrentDirectory() { string testDir = GetTestFilePath(); diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/SetCurrentDirectory.cs b/src/libraries/System.IO.FileSystem/tests/Directory/SetCurrentDirectory.cs index 9fa2683e46f2b..e222dabef8e60 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/SetCurrentDirectory.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/SetCurrentDirectory.cs @@ -29,7 +29,7 @@ public void SetToNonExistentDirectory_ThrowsDirectoryNotFoundException() Assert.Throws(() => Directory.SetCurrentDirectory(GetTestFilePath())); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetToValidOtherDirectory() { RemoteExecutor.Invoke(() => @@ -47,7 +47,9 @@ public void SetToValidOtherDirectory() public sealed class Directory_SetCurrentDirectory_SymLink : FileSystemTest { - [ConditionalFact(nameof(CanCreateSymbolicLinks))] + private static bool CanCreateSymbolicLinksAndRemoteExecutorSupported => CanCreateSymbolicLinks && RemoteExecutor.IsSupported; + + [ConditionalFact(nameof(CanCreateSymbolicLinksAndRemoteExecutorSupported))] public void SetToPathContainingSymLink() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/Exists.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/Exists.cs index 9039b53eff780..815c39348f41a 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/Exists.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/Exists.cs @@ -132,7 +132,7 @@ public void SymLinksMayExistIndependentlyOfTarget() Assert.False(linkPathFI.Exists, "linkPath should no longer exist"); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void UnsharedFileExists() { string path = GetTestFilePath(); @@ -146,7 +146,7 @@ public void UnsharedFileExists() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(~TestPlatforms.OSX)] public void LockedFileExists() { diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs index 55eaecef0ca9d..14d786c776ac1 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs @@ -66,7 +66,7 @@ protected override void Dispose(bool disposing) } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Dispose_CallsVirtualDisposeTrueArg_ThrowsDuringFlushWriteBuffer_DisposeThrows() { RemoteExecutor.Invoke(() => @@ -111,7 +111,9 @@ public void Dispose_CallsVirtualDisposeTrueArg_ThrowsDuringFlushWriteBuffer_Disp }).Dispose(); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + private static bool IsPreciseGcSupportedAndRemoteExecutorSupported => PlatformDetection.IsPreciseGcSupported && RemoteExecutor.IsSupported; + + [ConditionalFact(nameof(IsPreciseGcSupportedAndRemoteExecutorSupported))] public void NoDispose_CallsVirtualDisposeFalseArg_ThrowsDuringFlushWriteBuffer_FinalizerWontThrow() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/LockUnlock.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/LockUnlock.cs index bcfdaa58a5a55..e44c0fc0eb879 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/LockUnlock.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/LockUnlock.cs @@ -154,7 +154,9 @@ public void OverlappingRegionsFromSameProcess_AllowedOnUnix(long fileLength, lon } } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/dotnet/runtime/issues/28330 + private static bool IsNotWindowsSubsystemForLinuxAndRemoteExecutorSupported => PlatformDetection.IsNotWindowsSubsystemForLinux && RemoteExecutor.IsSupported; + + [ConditionalTheory(nameof(IsNotWindowsSubsystemForLinuxAndRemoteExecutorSupported))] // https://github.com/dotnet/runtime/issues/28330 [InlineData(10, 0, 10, 1, 2)] [InlineData(10, 3, 5, 3, 5)] [InlineData(10, 3, 5, 3, 4)] diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs index b28f8d09e5003..ccf054612bfd9 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs @@ -59,7 +59,7 @@ public void FileShareOpen() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FileShareOpen_Inheritable() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs index 9ee7d0e7e332a..dba8098e6d562 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs @@ -9,7 +9,7 @@ namespace System.IO.MemoryMappedFiles.Tests { public class CrossProcessTests : FileCleanupTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DataShared() { // Create a new file and load it into an MMF diff --git a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CrossProcess.cs b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CrossProcess.cs index b8b8d26c5c02f..4189e3fb4c05d 100644 --- a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CrossProcess.cs +++ b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CrossProcess.cs @@ -11,7 +11,7 @@ namespace System.IO.Pipes.Tests { public class AnonymousPipeTest_CrossProcess { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void PingPong() { // Create two anonymous pipes, one for each direction of communication. @@ -49,7 +49,7 @@ void ChildFunc(string inHandle, string outHandle) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ServerClosesPipe_ClientReceivesEof() { using (var pipe = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable)) @@ -76,7 +76,7 @@ void ChildFunc(string clientHandle) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ClientClosesPipe_ServerReceivesEof() { using (var pipe = new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable)) diff --git a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs index 63b3a3566d569..1acb9e16251a5 100644 --- a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs +++ b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs @@ -14,7 +14,7 @@ namespace System.IO.Pipes.Tests { public sealed class NamedPipeTest_CrossProcess { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void InheritHandles_AvailableInChildProcess() { string pipeName = GetUniquePipeName(); @@ -45,7 +45,7 @@ void ChildFunc(string handle) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void PingPong_Sync() { // Create names for two pipes @@ -71,7 +71,7 @@ public void PingPong_Sync() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task PingPong_Async() { // Create names for two pipes diff --git a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.Unix.cs b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.Unix.cs index 9c642125b2b85..dd3b40ae9661a 100644 --- a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.Unix.cs +++ b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.Unix.cs @@ -24,7 +24,7 @@ public NamedPipeTest_CurrentUserOnly_Unix(ITestOutputHelper output) _output = output; } - [ConditionalTheory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop("Needs sudo access")] [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] [InlineData(PipeOptions.None, PipeOptions.None)] diff --git a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Unix.cs b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Unix.cs index e3d5fd9417855..a12803e204e56 100644 --- a/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Unix.cs +++ b/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Unix.cs @@ -20,12 +20,9 @@ public class NamedPipeTest_RunAsClient [DllImport("libc", SetLastError = true)] internal static extern unsafe uint geteuid(); - public static bool IsSuperUser() - { - return geteuid() == 0; - } + public static bool IsSuperUserAndRemoteExecutorSupported => geteuid() == 0 && RemoteExecutor.IsSupported; - [ConditionalFact(nameof(IsSuperUser))] + [ConditionalFact(nameof(IsSuperUserAndRemoteExecutorSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes [ActiveIssue("https://github.com/dotnet/runtime/issues/0")] public void RunAsClient_Unix() diff --git a/src/libraries/System.Linq.Parallel/tests/EtwTests.cs b/src/libraries/System.Linq.Parallel/tests/EtwTests.cs index 3656c769c520c..c38e7fc397e6a 100644 --- a/src/libraries/System.Linq.Parallel/tests/EtwTests.cs +++ b/src/libraries/System.Linq.Parallel/tests/EtwTests.cs @@ -12,7 +12,7 @@ namespace System.Linq.Parallel.Tests { public class EtwTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void TestEtw() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index 1019de971acf8..8ab8c7f5886e0 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -25,8 +25,8 @@ public abstract class DiagnosticsTest : HttpClientHandlerTestBase private const string EnableActivityPropagationEnvironmentVariableSettingName = "DOTNET_SYSTEM_NET_HTTP_ENABLEACTIVITYPROPAGATION"; private const string EnableActivityPropagationAppCtxSettingName = "System.Net.Http.EnableActivityPropagation"; - private static bool EnableActivityPropagationEnvironmentVariableIsNotSet => - string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnableActivityPropagationEnvironmentVariableSettingName)); + private static bool EnableActivityPropagationEnvironmentVariableIsNotSetAndRemoteExecutorSupported => + string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnableActivityPropagationEnvironmentVariableSettingName)) && RemoteExecutor.IsSupported; public DiagnosticsTest(ITestOutputHelper output) : base(output) { } @@ -53,7 +53,7 @@ public static void EventSource_ExistsWithCorrectId() /// DiagnosticSources, since the global logging mechanism makes them conflict inherently. /// [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceLogging() { RemoteExecutor.Invoke(useVersionString => @@ -121,7 +121,7 @@ public void SendAsync_ExpectedDiagnosticSourceLogging() /// DiagnosticSources, since the global logging mechanism makes them conflict inherently. /// [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceNoLogging() { RemoteExecutor.Invoke(useVersionString => @@ -177,7 +177,7 @@ public void SendAsync_ExpectedDiagnosticSourceNoLogging() [ActiveIssue("https://github.com/dotnet/runtime/issues/1477", TestPlatforms.AnyUnix)] [OuterLoop("Uses external server")] - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public void SendAsync_HttpTracingEnabled_Succeeds(bool useSsl) @@ -225,7 +225,7 @@ await TestHelper.WhenAllCompletedOrAnyFailed( } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticExceptionLogging() { RemoteExecutor.Invoke(useVersionString => @@ -272,7 +272,7 @@ public void SendAsync_ExpectedDiagnosticExceptionLogging() [ActiveIssue("https://github.com/dotnet/runtime/issues/23167")] [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticCancelledLogging() { RemoteExecutor.Invoke(useVersionString => @@ -317,7 +317,7 @@ await Assert.ThrowsAnyAsync(() => }, UseVersion.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceActivityLoggingRequestId() { RemoteExecutor.Invoke(useVersionString => @@ -401,7 +401,7 @@ public void SendAsync_ExpectedDiagnosticSourceActivityLoggingRequestId() }, UseVersion.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceActivityLoggingW3C() { RemoteExecutor.Invoke(useVersionString => @@ -485,7 +485,7 @@ public void SendAsync_ExpectedDiagnosticSourceActivityLoggingW3C() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceActivityLogging_InvalidBaggage() { RemoteExecutor.Invoke(useVersionString => @@ -543,7 +543,7 @@ public void SendAsync_ExpectedDiagnosticSourceActivityLogging_InvalidBaggage() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceActivityLoggingDoesNotOverwriteHeader() { RemoteExecutor.Invoke(useVersionString => @@ -598,7 +598,7 @@ public void SendAsync_ExpectedDiagnosticSourceActivityLoggingDoesNotOverwriteHea } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceActivityLoggingDoesNotOverwriteW3CTraceParentHeader() { Assert.True(UseVersion.Major < 2, "The test currently only supports HTTP/1."); @@ -654,7 +654,7 @@ public void SendAsync_ExpectedDiagnosticSourceActivityLoggingDoesNotOverwriteW3C } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceUrlFilteredActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -701,7 +701,7 @@ public void SendAsync_ExpectedDiagnosticSourceUrlFilteredActivityLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticExceptionActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -748,7 +748,7 @@ public void SendAsync_ExpectedDiagnosticExceptionActivityLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSynchronousExceptionActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -810,7 +810,7 @@ public void SendAsync_ExpectedDiagnosticSynchronousExceptionActivityLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticSourceNewAndDeprecatedEventsLogging() { RemoteExecutor.Invoke(useVersionString => @@ -860,7 +860,7 @@ public void SendAsync_ExpectedDiagnosticSourceNewAndDeprecatedEventsLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticExceptionOnlyActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -901,7 +901,7 @@ public void SendAsync_ExpectedDiagnosticExceptionOnlyActivityLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticStopOnlyActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -941,7 +941,7 @@ public void SendAsync_ExpectedDiagnosticStopOnlyActivityLogging() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedActivityPropagationWithoutListener() { RemoteExecutor.Invoke(useVersionString => @@ -958,7 +958,7 @@ public void SendAsync_ExpectedActivityPropagationWithoutListener() } [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedActivityPropagationWithoutListenerOrParentActivity() { RemoteExecutor.Invoke(useVersionString => @@ -976,7 +976,7 @@ public void SendAsync_ExpectedActivityPropagationWithoutListenerOrParentActivity } [OuterLoop("Uses external server")] - [ConditionalTheory(nameof(EnableActivityPropagationEnvironmentVariableIsNotSet))] + [ConditionalTheory(nameof(EnableActivityPropagationEnvironmentVariableIsNotSetAndRemoteExecutorSupported))] [InlineData("true", true)] [InlineData("1", true)] [InlineData("0", false)] @@ -1026,7 +1026,7 @@ public void SendAsync_SuppressedGlobalStaticPropagationEnvVar(string envVarValue } [OuterLoop("Uses external server")] - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true)] [InlineData(false)] public void SendAsync_SuppressedGlobalStaticPropagationNoListenerAppCtx(bool switchValue) @@ -1048,7 +1048,7 @@ public void SendAsync_SuppressedGlobalStaticPropagationNoListenerAppCtx(bool swi [ActiveIssue("https://github.com/dotnet/runtime/issues/23167")] [OuterLoop("Uses external server")] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_ExpectedDiagnosticCancelledActivityLogging() { RemoteExecutor.Invoke(useVersionString => @@ -1094,7 +1094,7 @@ await Assert.ThrowsAnyAsync(() => }, UseVersion.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SendAsync_NullRequest_ThrowsArgumentNullException() { RemoteExecutor.Invoke(async () => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs index 544f188bd5770..62ff7ace2e248 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs @@ -684,7 +684,7 @@ public void DefaultProxy_Get_ReturnsNotNull() Assert.NotNull(proxy); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultProxy_SetGet_Roundtrips() { RemoteExecutor.Invoke(() => @@ -695,7 +695,7 @@ public void DefaultProxy_SetGet_Roundtrips() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultProxy_Credentials_SetGet_Roundtrips() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index fe7560db7089d..066cf5c66ebd4 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -1622,7 +1622,7 @@ await Http2LoopbackServerFactory.CreateServerAsync(async (server, url) => } [OuterLoop] - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public void ConnectionsPooledThenDisposed_NoUnobservedTaskExceptions(bool secure) diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs index e0486d4b76902..f5cf457b27687 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs @@ -136,7 +136,7 @@ public void ToString_UseResponseDirectiveValues_AllSerializedCorrectly() Assert.Equal("must-revalidate, proxy-revalidate, private=\"token2, token3\"", cacheControl.ToString()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ToString_NegativeValues_UsesMinusSignRegardlessOfCurrentCulture() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs index e168d3fff696d..9d76bfa61b78f 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs @@ -41,7 +41,7 @@ public HttpEnvironmentProxyTest(ITestOutputHelper output) CleanEnv(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void HttpProxy_EnvironmentProxy_Loaded() { RemoteExecutor.Invoke(() => @@ -128,7 +128,7 @@ public void HttpProxy_EnvironmentProxy_Loaded() }).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("1.1.1.5", "1.1.1.5", "80", null, null)] [InlineData("http://1.1.1.5:3005", "1.1.1.5", "3005", null, null)] [InlineData("http://foo@1.1.1.5", "1.1.1.5", "80", "foo", "")] @@ -178,7 +178,7 @@ public void HttpProxy_Uri_Parsing(string _input, string _host, string _port, str }, _input, _host, _port, _user ?? "null", _password ?? "null").Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void HttpProxy_CredentialParsing_Basic() { RemoteExecutor.Invoke(() => @@ -210,7 +210,7 @@ public void HttpProxy_CredentialParsing_Basic() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void HttpProxy_Exceptions_Match() { RemoteExecutor.Invoke(() => @@ -238,7 +238,7 @@ public static IEnumerable HttpProxyNoProxyEnvVarMemberData() yield return new object[] { "HTTP_PROXY", "NO_PROXY" }; } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(HttpProxyNoProxyEnvVarMemberData))] public void HttpProxy_TryCreate_CaseInsensitiveVariables(string proxyEnvVar, string noProxyEnvVar) { @@ -270,7 +270,7 @@ public static IEnumerable HttpProxyCgiEnvVarMemberData() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(HttpProxyCgiEnvVarMemberData))] public void HttpProxy_TryCreateAndPossibleCgi_HttpProxyUpperCaseDisabledInCgi( string proxyEnvVar, bool cgi, bool expectedProxyUse) diff --git a/src/libraries/System.Net.Http/tests/UnitTests/HttpWindowsProxyTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/HttpWindowsProxyTest.cs index 2b47a3524ed4c..b67e597bb663f 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/HttpWindowsProxyTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/HttpWindowsProxyTest.cs @@ -31,7 +31,7 @@ public HttpWindowsProxyTest(ITestOutputHelper output) _output = output; } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(ProxyParsingData))] public void HttpProxy_WindowsProxy_Manual_Loaded(string rawProxyString, string rawInsecureUri, string rawSecureUri) { @@ -58,7 +58,7 @@ public void HttpProxy_WindowsProxy_Manual_Loaded(string rawProxyString, string r }, rawProxyString, rawInsecureUri ?? string.Empty, rawSecureUri ?? string.Empty).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(ProxyParsingData))] public void HttpProxy_WindowsProxy_PAC_Loaded(string rawProxyString, string rawInsecureUri, string rawSecureUri) { @@ -115,7 +115,7 @@ public void HttpProxy_WindowsProxy_PAC_Loaded(string rawProxyString, string rawI { "proxy.secure-and-insecure.com", secureAndInsecureProxyUri, secureAndInsecureProxyUri }, }; - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("localhost:1234", "http://localhost:1234/")] [InlineData("123.123.123.123", "http://123.123.123.123/")] public void HttpProxy_WindowsProxy_Loaded(string rawProxyString, string expectedUri) @@ -136,7 +136,7 @@ public void HttpProxy_WindowsProxy_Loaded(string rawProxyString, string expected }, rawProxyString, expectedUri).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("http://localhost/", true)] [InlineData("http://127.0.0.1/", true)] [InlineData("http://128.0.0.1/", false)] @@ -173,7 +173,7 @@ public void HttpProxy_Local_Bypassed(string name, bool shouldBypass) }, name, shouldBypass.ToString()).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("", 0)] [InlineData(" ", 0)] [InlineData(" ; ; ", 0)] @@ -207,7 +207,7 @@ public void HttpProxy_Local_Parsing(string bypass, int count) }, bypass, count.ToString()).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("http://")] [InlineData("http=")] [InlineData("http://;")] @@ -235,7 +235,7 @@ public void HttpProxy_InvalidWindowsProxy_Null(string rawProxyString) }, rawProxyString).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(HttpProxy_Multi_Data))] public void HttpProxy_Multi_Success(bool manualConfig, string proxyConfig, string url, string expected) { @@ -292,7 +292,7 @@ public static IEnumerable HttpProxy_Multi_Data() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] public void HttpProxy_Multi_ConcurrentUse_Success(bool manualConfig) diff --git a/src/libraries/System.Net.Http/tests/UnitTests/SystemProxyInfoTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/SystemProxyInfoTest.cs index 7074b1df98889..8c0c7cbf482e1 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/SystemProxyInfoTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/SystemProxyInfoTest.cs @@ -32,7 +32,7 @@ public SystemProxyInfoTest() CleanEnv(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_NoEnvironmentVariables_NotHttpEnvironmentProxy() { RemoteExecutor.Invoke(() => @@ -45,7 +45,7 @@ public void Ctor_NoEnvironmentVariables_NotHttpEnvironmentProxy() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_ProxyEnvironmentVariableSet_IsHttpEnvironmentProxy() { var options = new RemoteInvokeOptions(); diff --git a/src/libraries/System.Net.Mail/tests/Functional/LoggingTest.cs b/src/libraries/System.Net.Mail/tests/Functional/LoggingTest.cs index 2e24c69e551a8..d9e045cbe5e4a 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/LoggingTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/LoggingTest.cs @@ -24,7 +24,7 @@ public void EventSource_ExistsWithCorrectId() Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EventSource_EventsRaisedAsExpected() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs index 5d69069dc9b37..cb523acdeabe3 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -888,7 +888,7 @@ public async Task Ping_TimedOut_TAP_Success() } [PlatformSpecific(TestPlatforms.AnyUnix)] - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] [InlineData(AddressFamily.InterNetwork)] [InlineData(AddressFamily.InterNetworkV6)] diff --git a/src/libraries/System.Net.Primitives/tests/FunctionalTests/LoggingTest.cs b/src/libraries/System.Net.Primitives/tests/FunctionalTests/LoggingTest.cs index 858c75bc91a81..9a7141a84b5da 100644 --- a/src/libraries/System.Net.Primitives/tests/FunctionalTests/LoggingTest.cs +++ b/src/libraries/System.Net.Primitives/tests/FunctionalTests/LoggingTest.cs @@ -24,7 +24,7 @@ public void EventSource_ExistsWithCorrectId() Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EventSource_EventsRaisedAsExpected() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs b/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs index 2aacd2ba0b614..7563f5bcb4710 100644 --- a/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs +++ b/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs @@ -32,7 +32,7 @@ public void Unregister_Null_Throws() Assert.Throws(() => AuthenticationManager.Unregister((string)null)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Register_Unregister_ModuleCountUnchanged() { RemoteExecutor.Invoke(() => @@ -45,7 +45,7 @@ public void Register_Unregister_ModuleCountUnchanged() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Register_UnregisterByScheme_ModuleCountUnchanged() { RemoteExecutor.Invoke(() => @@ -67,7 +67,7 @@ public void RegisteredModules_DefaultCount_ExpectedValue() Assert.Equal(0, count); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CredentialPolicy_Roundtrip() { Assert.Null(AuthenticationManager.CredentialPolicy); @@ -83,7 +83,7 @@ public void CredentialPolicy_Roundtrip() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CustomTargetNameDictionary_ValidCollection() { Assert.NotNull(AuthenticationManager.CustomTargetNameDictionary); diff --git a/src/libraries/System.Net.Requests/tests/GlobalProxySelectionTest.cs b/src/libraries/System.Net.Requests/tests/GlobalProxySelectionTest.cs index 01613fb8da660..d060c04aa9b38 100644 --- a/src/libraries/System.Net.Requests/tests/GlobalProxySelectionTest.cs +++ b/src/libraries/System.Net.Requests/tests/GlobalProxySelectionTest.cs @@ -37,7 +37,7 @@ public bool IsBypassed(Uri host) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Select_Success() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs index 6b4fc56e52917..43dc5cf16368d 100644 --- a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs @@ -765,7 +765,7 @@ public void Expect_Set100Continue_ThrowsArgumentException(Uri remoteServer) AssertExtensions.Throws("value", () => request.Expect = "100-continue"); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultMaximumResponseHeadersLength_SetAndGetLength_ValuesMatch() { RemoteExecutor.Invoke(() => @@ -785,7 +785,7 @@ public void DefaultMaximumResponseHeadersLength_SetAndGetLength_ValuesMatch() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultMaximumErrorResponseLength_SetAndGetLength_ValuesMatch() { RemoteExecutor.Invoke(() => @@ -805,7 +805,7 @@ public void DefaultMaximumErrorResponseLength_SetAndGetLength_ValuesMatch() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultCachePolicy_SetAndGetPolicyReload_ValuesMatch() { RemoteExecutor.Invoke(() => @@ -1489,7 +1489,7 @@ public void Proxy_GetDefault_ExpectNotNull(Uri remoteServer) [ActiveIssue("https://github.com/dotnet/runtime/issues/31380")] [OuterLoop("Uses external server")] [PlatformSpecific(TestPlatforms.AnyUnix)] // The default proxy is resolved via WinINet on Windows. - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task ProxySetViaEnvironmentVariable_DefaultProxyCredentialsUsed() { var cred = new NetworkCredential(Guid.NewGuid().ToString("N"), Guid.NewGuid().ToString("N")); @@ -1622,7 +1622,7 @@ public void MediaType_SetThenGet_ValuesMatch(Uri remoteServer) Assert.Equal(MediaType, request.MediaType); } - [Theory, MemberData(nameof(MixedWebRequestParameters))] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported)), MemberData(nameof(MixedWebRequestParameters))] public void GetResponseAsync_ParametersAreNotCachable_CreateNewClient(HttpWebRequestParameters requestParameters, bool connectionReusedParameter) { RemoteExecutor.Invoke(async (serializedParameters, connectionReusedString) => @@ -1671,7 +1671,7 @@ public void GetResponseAsync_ParametersAreNotCachable_CreateNewClient(HttpWebReq }, JsonSerializer.Serialize(requestParameters), connectionReusedParameter.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetResponseAsync_ParametersAreCachableButDifferent_CreateNewClient() { RemoteExecutor.Invoke(async () => diff --git a/src/libraries/System.Net.Requests/tests/WebRequestTest.cs b/src/libraries/System.Net.Requests/tests/WebRequestTest.cs index e558dbd9b00fe..387dda13d24e2 100644 --- a/src/libraries/System.Net.Requests/tests/WebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/WebRequestTest.cs @@ -30,7 +30,7 @@ public void DefaultWebProxy_VerifyDefaults_Success() Assert.Null(initialDefaultWebProxyCredentials); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DefaultWebProxy_SetThenGet_ValuesMatch() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs index d7866e9d9525e..539d0c69c1609 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs @@ -24,7 +24,7 @@ public void EventSource_ExistsWithCorrectId() Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location)); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EventSource_EventsRaisedAsExpected() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.ServicePoint/tests/ServicePointManagerTest.cs b/src/libraries/System.Net.ServicePoint/tests/ServicePointManagerTest.cs index 7c7a64a8cb06e..7cf7edc5bc501 100644 --- a/src/libraries/System.Net.ServicePoint/tests/ServicePointManagerTest.cs +++ b/src/libraries/System.Net.ServicePoint/tests/ServicePointManagerTest.cs @@ -195,7 +195,7 @@ public static void UseNagleAlgorithm_Roundtrips() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void InvalidArguments_Throw() { RemoteExecutor.Invoke(() => @@ -247,7 +247,7 @@ public static void SecurityProtocol_Ssl3_NotSupported() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void FindServicePoint_ReturnsCachedServicePoint() { RemoteExecutor.Invoke(() => @@ -283,7 +283,7 @@ public static void FindServicePoint_ReturnsCachedServicePoint() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/36217", typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoInterpreter))] public static void FindServicePoint_Collectible() { @@ -302,7 +302,7 @@ public static void FindServicePoint_Collectible() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void FindServicePoint_ReturnedServicePointMatchesExpectedValues() { RemoteExecutor.Invoke(() => @@ -329,7 +329,7 @@ public static void FindServicePoint_ReturnedServicePointMatchesExpectedValues() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void FindServicePoint_PropertiesRoundtrip() { RemoteExecutor.Invoke(() => @@ -364,7 +364,7 @@ public static void FindServicePoint_PropertiesRoundtrip() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void FindServicePoint_NewServicePointsInheritCurrentValues() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/CreateSocketTests.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/CreateSocketTests.cs index 56d07d546a6d8..88b429c8e0ffc 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/CreateSocketTests.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/CreateSocketTests.cs @@ -124,7 +124,7 @@ public void Ctor_Raw_NotSupported_ExpectedError(AddressFamily addressFamily, Pro Assert.Contains(e.SocketErrorCode, new[] { SocketError.AccessDenied, SocketError.ProtocolNotSupported }); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true, 0)] // Accept [InlineData(false, 0)] [InlineData(true, 1)] // AcceptAsync diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs index 86b6289506ef6..b2c993af9c785 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs @@ -33,7 +33,7 @@ public static void EventSource_ExistsWithCorrectId() } [OuterLoop] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void EventSource_EventsRaisedAsExpected() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs index 68fcd850ce537..90f7cc89e0c76 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs @@ -1567,7 +1567,7 @@ public sealed class SendReceiveSync : SendReceive public SendReceiveSync(ITestOutputHelper output) : base(output) { } [OuterLoop] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void BlockingRead_DoesntRequireAnotherThreadPoolThread() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs index 80fea2d8f68d5..3bc81610e7e0e 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs @@ -168,7 +168,7 @@ public async Task DuplicateAndClose_TcpListener() } [PlatformSpecific(TestPlatforms.Windows)] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DuplicateSocket_IsNotInheritable() { // 300 ms should be long enough to connect if the socket is actually present & listening. @@ -305,7 +305,7 @@ private static SocketInformation ReadSocketInfo(Stream stream) { AddressFamily.InterNetworkV6, true }, }; - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] [MemberData(nameof(TcpServerHandlerData))] public async Task DuplicateAndClose_TcpServerHandler(AddressFamily addressFamily, bool sameProcess) diff --git a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs index 41902a6509c7d..5ff23bdb6634b 100644 --- a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs +++ b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs @@ -144,7 +144,7 @@ static System.Reflection.Assembly AssemblyResolveEventHandler(object sender, Res return null; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void GetString_ExpectEvents() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs index a8e661bafca7b..df15f49df6ce6 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs @@ -60,7 +60,7 @@ public void TargetFrameworkTest() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void UnhandledException_Add_Remove() { RemoteExecutor.Invoke(() => { @@ -69,7 +69,7 @@ public void UnhandledException_Add_Remove() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void UnhandledException_NotCalled_When_Handled() { RemoteExecutor.Invoke(() => { @@ -87,7 +87,7 @@ public void UnhandledException_NotCalled_When_Handled() [ActiveIssue("https://github.com/dotnet/runtime/issues/18984")] [PlatformSpecific(~TestPlatforms.OSX)] // Unhandled exception on a separate process causes xunit to crash on osx - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void UnhandledException_Called() { System.IO.File.Delete("success.txt"); @@ -135,7 +135,7 @@ public void FriendlyName() Assert.Equal(expected, s); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Id() { // if running directly on some platforms Xunit may be Id = 1 @@ -150,13 +150,13 @@ public void IsFullyTrusted() Assert.True(AppDomain.CurrentDomain.IsFullyTrusted); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IsHomogenous() { Assert.True(AppDomain.CurrentDomain.IsHomogenous); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FirstChanceException_Add_Remove() { RemoteExecutor.Invoke(() => { @@ -166,7 +166,7 @@ public void FirstChanceException_Add_Remove() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/mono/mono/issues/16246", TestRuntimes.Mono)] public void FirstChanceException_Called() { @@ -199,7 +199,7 @@ public FirstChanceTestException(string message) : base(message) { } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ProcessExit_Add_Remove() { RemoteExecutor.Invoke(() => { @@ -209,7 +209,7 @@ public void ProcessExit_Add_Remove() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ProcessExit_Called() { string path = GetTestFilePath(); @@ -243,7 +243,7 @@ public void CreateDomainNonNetfx() Assert.Throws(() => { AppDomain.CreateDomain("test"); }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ExecuteAssemblyByName() { RemoteExecutor.Invoke(() => { @@ -274,7 +274,7 @@ public void ExecuteAssembly() Assert.Equal(10, AppDomain.CurrentDomain.ExecuteAssembly(name, new string[2] { "2", "3" })); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetData_SetData() { RemoteExecutor.Invoke(() => { @@ -286,7 +286,7 @@ public void GetData_SetData() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetData_SameKeyMultipleTimes_ReplacesOldValue() { RemoteExecutor.Invoke(() => { @@ -308,7 +308,7 @@ public void IsCompatibilitySwitchSet() Assert.Null(AppDomain.CurrentDomain.IsCompatibilitySwitchSet("randomSwitch")); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void IsDefaultAppDomain() { // Xunit may be default app domain if run directly @@ -324,7 +324,7 @@ public void IsFinalizingForUnload() Assert.False(AppDomain.CurrentDomain.IsFinalizingForUnload()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void toString() { // Workaround issue: UWP culture is process wide @@ -340,7 +340,7 @@ public void toString() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Unload() { RemoteExecutor.Invoke(() => { @@ -410,7 +410,7 @@ public void ShadowCopyFiles() Assert.False(AppDomain.CurrentDomain.ShadowCopyFiles); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void AppendPrivatePath() { RemoteExecutor.Invoke(() => { @@ -418,7 +418,7 @@ public void AppendPrivatePath() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ClearPrivatePath() { RemoteExecutor.Invoke(() => { @@ -426,7 +426,7 @@ public void ClearPrivatePath() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void ClearShadowCopyPath() { RemoteExecutor.Invoke(() => { @@ -434,7 +434,7 @@ public void ClearShadowCopyPath() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetCachePath() { RemoteExecutor.Invoke(() => { @@ -442,7 +442,7 @@ public void SetCachePath() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetShadowCopyFiles() { RemoteExecutor.Invoke(() => { @@ -450,7 +450,7 @@ public void SetShadowCopyFiles() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetShadowCopyPath() { RemoteExecutor.Invoke(() => { @@ -459,7 +459,7 @@ public void SetShadowCopyPath() } #pragma warning restore 618 - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetAssemblies() { RemoteExecutor.Invoke(() => { @@ -496,7 +496,7 @@ public void GetAssemblies() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void AssemblyLoad() { RemoteExecutor.Invoke(() => { @@ -527,7 +527,7 @@ public void AssemblyLoad() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void AssemblyResolveInvalidAssemblyName() { RemoteExecutor.Invoke(() => { @@ -550,7 +550,7 @@ public void AssemblyResolveInvalidAssemblyName() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void AssemblyResolve() { CopyTestAssemblies(); @@ -576,7 +576,7 @@ public void AssemblyResolve() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void AssemblyResolve_RequestingAssembly() { CopyTestAssemblies(); @@ -606,7 +606,7 @@ public void AssemblyResolve_RequestingAssembly() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/mono/mono/issues/16246", TestRuntimes.Mono)] public void AssemblyResolve_IsNotCalledForCoreLibResources() { @@ -639,7 +639,7 @@ public void AssemblyResolve_IsNotCalledForCoreLibResources() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TypeResolve() { RemoteExecutor.Invoke(() => { @@ -669,7 +669,7 @@ public void TypeResolve() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/mono/mono/issues/16246", TestRuntimes.Mono)] public void ResourceResolve() { @@ -701,7 +701,7 @@ public void ResourceResolve() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void SetThreadPrincipal() { RemoteExecutor.Invoke(() => { @@ -729,7 +729,7 @@ private void CopyTestAssemblies() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetSetupInformation() { RemoteExecutor.Invoke(() => { @@ -738,7 +738,7 @@ public void GetSetupInformation() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void GetPermissionSet() { RemoteExecutor.Invoke(() => { @@ -911,7 +911,7 @@ public static IEnumerable TestingCreateInstanceObjectHandleFullSignatu yield return new object[] { "assemblyresolvetestapp", "assemblyresolvetestapp.privateclasssample", true, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, Type.DefaultBinder, new object[1] { 1 }, CultureInfo.InvariantCulture, null, "AssemblyResolveTestApp.PrivateClassSample" }; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/mono/mono/issues/16246", TestRuntimes.Mono)] public void AssemblyResolve_FirstChanceException() { diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Environment.Exit.cs b/src/libraries/System.Runtime.Extensions/tests/System/Environment.Exit.cs index cec38528dad3d..de81394927b90 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Environment.Exit.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Environment.Exit.cs @@ -21,7 +21,7 @@ public class Environment_Exit new object[] { 255 }, }; - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(ExitCodeValues))] public static void CheckExitCode(int expectedExitCode) { diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs b/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs index 168da52d098eb..94bd2bcde0004 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs @@ -22,7 +22,7 @@ public static IEnumerable GetCommandLineArgs_TestData() yield return new object[] { new string[] { "arg1", @"\\\\\" + "\"alpha", @"\" + "\"arg3" } }; } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(GetCommandLineArgs_TestData))] public void GetCommandLineArgs_Invoke_ReturnsExpected(string[] args) { diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs b/src/libraries/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs index 60eea2ccd11aa..f48fc21d34f8a 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs @@ -76,7 +76,7 @@ public void AllowAnyVariableValueLengths() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void EnvironmentVariableTooLarge_Throws() { @@ -111,7 +111,7 @@ public void EnvironmentVariableTooLarge_Throws() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public void EnvironmentVariableValueTooLarge_Throws() { diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 5129caf6dc8e8..1950a8e3df1d0 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -37,7 +37,7 @@ public void CurrentDirectory_SetToNonExistentDirectory_ThrowsDirectoryNotFoundEx Assert.Throws(() => Environment.CurrentDirectory = GetTestFilePath()); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CurrentDirectory_SetToValidOtherDirectory() { RemoteExecutor.Invoke(() => @@ -212,7 +212,7 @@ public void WorkingSet_Valid() [Trait(XunitConstants.Category, XunitConstants.IgnoreForCI)] // fail fast crashes the process [OuterLoop] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FailFast_ExpectFailureExitCode() { using (RemoteInvokeHandle handle = RemoteExecutor.Invoke(() => Environment.FailFast("message"))) @@ -233,7 +233,7 @@ public void FailFast_ExpectFailureExitCode() } [Trait(XunitConstants.Category, XunitConstants.IgnoreForCI)] // fail fast crashes the process - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FailFast_ExceptionStackTrace_ArgumentException() { var psi = new ProcessStartInfo(); @@ -254,7 +254,7 @@ public void FailFast_ExceptionStackTrace_ArgumentException() } [Trait(XunitConstants.Category, XunitConstants.IgnoreForCI)] // fail fast crashes the process - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FailFast_ExceptionStackTrace_StackOverflowException() { // Test using another type of exception @@ -276,7 +276,7 @@ public void FailFast_ExceptionStackTrace_StackOverflowException() } [Trait(XunitConstants.Category, XunitConstants.IgnoreForCI)] // fail fast crashes the process - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void FailFast_ExceptionStackTrace_InnerException() { // Test if inner exception details are also logged diff --git a/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Unix.cs b/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Unix.cs index 7f57a8d659ced..b6d6b6b3d7502 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Unix.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Unix.cs @@ -48,7 +48,7 @@ public static IEnumerable GetTempPath_SetEnvVar_Data() yield return new string[] { "/tmp/", null }; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetTempPath_SetEnvVar_Unix() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Windows.cs b/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Windows.cs index e6fbb701bf3ab..fd28ca1485001 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Windows.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/IO/PathTests_Windows.cs @@ -70,7 +70,7 @@ public static IEnumerable GetTempPath_SetEnvVar_Data() yield return new string[] { @"C:\tmp\", @"C:\tmp\" }; } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetTempPath_SetEnvVar() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.cs b/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.cs index 21d526709299c..6c494e8885372 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.cs @@ -11,7 +11,7 @@ namespace System.Runtime.Tests { public class ProfileOptimizationTest : FileCleanupTestBase { - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(false)] [InlineData(true)] [ActiveIssue("https://github.com/dotnet/runtime/issues/31853", TestRuntimes.Mono)] diff --git a/src/libraries/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.cs index aa5f505c79de4..9c03a4d48ab44 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.cs @@ -12,7 +12,7 @@ namespace System.Tests { public class UnloadingAndProcessExitTests : FileCleanupTestBase { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void UnloadingEventMustHappenBeforeProcessExitEvent() { string fileName = GetTestFilePath(); diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs index f907025069765..ea51b356d5e6b 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs @@ -19,7 +19,7 @@ public void VerifyOSRid() Assert.EndsWith(RuntimeInformation.ProcessArchitecture.ToString(), RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void VerifyEnvironmentVariable() { RemoteInvokeOptions options = new RemoteInvokeOptions(); @@ -31,7 +31,7 @@ public void VerifyEnvironmentVariable() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void VerifyAppContextVariable() { RemoteExecutor.Invoke(() => @@ -42,7 +42,7 @@ public void VerifyAppContextVariable() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void VerifyAppContextVariableUnknown() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs index 8f7f1fd03e5c2..e0a792cba127a 100644 --- a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs +++ b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs @@ -170,7 +170,7 @@ void FixtureIsSetupCorrectly() } #region EnterContextualReflectionAndDispose - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CurrentContextualReflectionContextInitialValueNull() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs index cafbed1ecd9e8..664f1bd9ed039 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs @@ -482,7 +482,7 @@ public void Deserialize_EndOfStream_ThrowsException() } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(CrossProcessObjects_MemberData))] public void Roundtrip_CrossProcess(object obj) { diff --git a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs index 3bd763b8655dc..803dd48719658 100644 --- a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs +++ b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs @@ -787,7 +787,7 @@ public class PublicType public PublicType() { } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void CreateInstanceAssemblyResolve() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime/tests/System/ComponentModel/DefaultValueAttributeTests.cs b/src/libraries/System.Runtime/tests/System/ComponentModel/DefaultValueAttributeTests.cs index 97c85372e85a9..85388f3c88de7 100644 --- a/src/libraries/System.Runtime/tests/System/ComponentModel/DefaultValueAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System/ComponentModel/DefaultValueAttributeTests.cs @@ -72,7 +72,7 @@ public static void Ctor_CustomTypeConverter() Assert.Equal(42, ((CustomType)attr.Value).Value); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(typeof(CustomType), true, "", 0)] [InlineData(typeof(int), false, "42", 42)] public void Ctor_TypeDescriptorNotFound_ExceptionFallback(Type type, bool returnNull, string stringToConvert, int expectedValue) diff --git a/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs b/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs index b86cf0a018b69..7ffb6ac321fef 100644 --- a/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs +++ b/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs @@ -16,7 +16,7 @@ public class ExitCodeTests [DllImport("libc", SetLastError = true)] private static extern int kill(int pid, int sig); - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/31656", TestRuntimes.Mono)] [InlineData(null)] [InlineData(0)] diff --git a/src/libraries/System.Runtime/tests/System/GCTests.cs b/src/libraries/System.Runtime/tests/System/GCTests.cs index 4c8c309167735..34d11cdbb84f0 100644 --- a/src/libraries/System.Runtime/tests/System/GCTests.cs +++ b/src/libraries/System.Runtime/tests/System/GCTests.cs @@ -442,7 +442,7 @@ public class GCExtendedTests /// private const int NoGCRequestedBudget = 8192; - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void GetGeneration_WeakReference() { @@ -492,7 +492,7 @@ public static void GCNotificationNegTests() Assert.Throws(() => GC.WaitForFullGCComplete(-2)); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(true, -1)] [InlineData(false, -1)] [InlineData(true, 0)] @@ -512,7 +512,7 @@ public static void GCNotificationTests(bool approach, int timeout) }, approach.ToString(), timeout.ToString(), options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_EndNoGCRegion_ThrowsInvalidOperationException() { @@ -534,7 +534,7 @@ private static void AllocateALot() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_ExitThroughAllocation() { @@ -552,7 +552,7 @@ public static void TryStartNoGCRegion_ExitThroughAllocation() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_StartWhileInNoGCRegion() { @@ -567,7 +567,7 @@ public static void TryStartNoGCRegion_StartWhileInNoGCRegion() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_StartWhileInNoGCRegion_BlockingCollection() { @@ -582,7 +582,7 @@ public static void TryStartNoGCRegion_StartWhileInNoGCRegion_BlockingCollection( }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_StartWhileInNoGCRegion_LargeObjectHeapSize() { @@ -597,7 +597,7 @@ public static void TryStartNoGCRegion_StartWhileInNoGCRegion_LargeObjectHeapSize }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_StartWhileInNoGCRegion_BlockingCollectionAndLOH() { @@ -612,7 +612,7 @@ public static void TryStartNoGCRegion_StartWhileInNoGCRegion_BlockingCollectionA }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_SettingLatencyMode_ThrowsInvalidOperationException() { @@ -633,7 +633,7 @@ public static void TryStartNoGCRegion_SettingLatencyMode_ThrowsInvalidOperationE }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_SOHSize() { @@ -647,7 +647,7 @@ public static void TryStartNoGCRegion_SOHSize() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_SOHSize_BlockingCollection() { @@ -661,7 +661,7 @@ public static void TryStartNoGCRegion_SOHSize_BlockingCollection() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_SOHSize_LOHSize() { @@ -675,7 +675,7 @@ public static void TryStartNoGCRegion_SOHSize_LOHSize() }, options).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] public static void TryStartNoGCRegion_SOHSize_LOHSize_BlockingCollection() { @@ -689,7 +689,7 @@ public static void TryStartNoGCRegion_SOHSize_LOHSize_BlockingCollection() }, options).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] [InlineData(0)] [InlineData(-1)] @@ -703,7 +703,7 @@ public static void TryStartNoGCRegion_TotalSizeOutOfRange(long size) }, size.ToString(), options).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [OuterLoop] [InlineData(0)] // invalid because lohSize == [InlineData(-1)] // invalid because lohSize < 0 @@ -784,8 +784,10 @@ public static void GetAllocatedBytesForCurrentThread(int size) Assert.True((end - start) < 5 * size, $"Allocated too much: start: {start} end: {end} size: {size}"); } + private static bool IsNotArmProcessAndRemoteExecutorSupported => PlatformDetection.IsNotArmProcess && RemoteExecutor.IsSupported; + [ActiveIssue("https://github.com/mono/mono/issues/15236", TestRuntimes.Mono)] - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArmProcess))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/29434")] + [ConditionalFact(nameof(IsNotArmProcessAndRemoteExecutorSupported))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/29434")] public static void GetGCMemoryInfo() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime/tests/System/Reflection/IsCollectibleTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/IsCollectibleTests.cs index c808e075b820a..35572e83dd6b7 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/IsCollectibleTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/IsCollectibleTests.cs @@ -36,7 +36,7 @@ public static Func typeResolver(bool shouldThrowIf Type.GetType(simpleTypeName, shouldThrowIfNotFound, isCaseSensitive) : asm.GetType(simpleTypeName, shouldThrowIfNotFound, isCaseSensitive); - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Assembly_IsCollectibleFalse_WhenUsingAssemblyLoad() { RemoteExecutor.Invoke(() => { @@ -57,7 +57,7 @@ public void Assembly_IsCollectibleFalse_WhenUsingAssemblyLoad() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Assembly_IsCollectibleFalse_WhenUsingAssemblyLoadContext() { RemoteExecutor.Invoke(() => { @@ -78,7 +78,7 @@ public void Assembly_IsCollectibleFalse_WhenUsingAssemblyLoadContext() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Assembly_IsCollectibleTrue_WhenUsingTestAssemblyLoadContext() { RemoteExecutor.Invoke(() => { @@ -99,7 +99,7 @@ public void Assembly_IsCollectibleTrue_WhenUsingTestAssemblyLoadContext() }).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("MyField")] [InlineData("MyProperty")] [InlineData("MyMethod")] @@ -128,7 +128,7 @@ public void MemberInfo_IsCollectibleFalse_WhenUsingAssemblyLoad(string memberNam }, memberName).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("MyStaticGenericField")] [InlineData("MyStaticField")] [InlineData("MyStaticGenericMethod")] @@ -157,7 +157,7 @@ public void MemberInfoGeneric_IsCollectibleFalse_WhenUsingAssemblyLoad(string me }, memberName).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("MyField")] [InlineData("MyProperty")] [InlineData("MyMethod")] @@ -188,7 +188,7 @@ public void MemberInfo_IsCollectibleTrue_WhenUsingAssemblyLoadContext(string mem }, memberName).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("MyStaticGenericField")] [InlineData("MyStaticField")] [InlineData("MyStaticGenericMethod")] @@ -219,7 +219,7 @@ public void MemberInfoGeneric_IsCollectibleTrue_WhenUsingAssemblyLoadContext(str }, memberName).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GenericWithCollectibleTypeParameter_IsCollectibleTrue_WhenUsingAssemblyLoadContext() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Runtime/tests/System/Runtime/ExceptionServices/HandleProcessCorruptedStateExceptions.cs b/src/libraries/System.Runtime/tests/System/Runtime/ExceptionServices/HandleProcessCorruptedStateExceptions.cs index 95a4f7779a0fa..e678ede43ee74 100644 --- a/src/libraries/System.Runtime/tests/System/Runtime/ExceptionServices/HandleProcessCorruptedStateExceptions.cs +++ b/src/libraries/System.Runtime/tests/System/Runtime/ExceptionServices/HandleProcessCorruptedStateExceptions.cs @@ -36,7 +36,7 @@ static void CauseAVInNative() } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] // Feature Corrupting Exceptions not present for Linux public static void ProcessExit_Called() { diff --git a/src/libraries/System.Runtime/tests/System/StringGetHashCodeTests.cs b/src/libraries/System.Runtime/tests/System/StringGetHashCodeTests.cs index 82dbbb4486df1..f060b653c164c 100644 --- a/src/libraries/System.Runtime/tests/System/StringGetHashCodeTests.cs +++ b/src/libraries/System.Runtime/tests/System/StringGetHashCodeTests.cs @@ -17,7 +17,7 @@ public class StringGetHashCodeTests /// and confirming it is different (modulo possible values of int). /// If the legacy hash codes are being returned, it will not be different. /// - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(GetHashCode_TestData))] public void GetHashCodeWithStringComparer_UseSameStringInTwoProcesses_ReturnsDifferentHashCodes(int getHashCodeIndex) { diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index cb999a9b00fad..0e338424e5b0b 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -2270,7 +2270,7 @@ public static void EnsureUtcObjectSingleton() } // We test the existance of a specific English time zone name to avoid failures on non-English platforms. - [ConditionalFact(nameof(IsEnglishUILanguage))] + [ConditionalFact(nameof(IsEnglishUILanguageAndRemoteExecutorSupported))] public static void TestNameWithInvariantCulture() { RemoteExecutor.Invoke(() => @@ -2290,7 +2290,7 @@ public static void TestNameWithInvariantCulture() } - private static bool IsEnglishUILanguage() => CultureInfo.CurrentUICulture.Name == "en" || CultureInfo.CurrentUICulture.Name.StartsWith("en-", StringComparison.Ordinal); + private static bool IsEnglishUILanguageAndRemoteExecutorSupported => (CultureInfo.CurrentUICulture.Name == "en" || CultureInfo.CurrentUICulture.Name.StartsWith("en-", StringComparison.Ordinal)) && RemoteExecutor.IsSupported; private static void VerifyConvertException(DateTimeOffset inputTime, string destinationTimeZoneId) where TException : Exception { diff --git a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs index d45b52c90c57c..49a63b0da1642 100644 --- a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs @@ -582,7 +582,7 @@ public class ContextBoundClass : ContextBoundObject private static Func typeloader = (assem, name, ignore) => assem == null ? Type.GetType(name, false, ignore) : assem.GetType(name, false, ignore); - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetTypeByName() { RemoteInvokeOptions options = new RemoteInvokeOptions(); @@ -606,7 +606,7 @@ public void GetTypeByName() }, options).Dispose(); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("System.Collections.Generic.Dictionary`2[[Program, TestLoadAssembly], [Program2, TestLoadAssembly]]")] [InlineData("")] public void GetTypeByName_NoSuchType_ThrowsTypeLoadException(string typeName) @@ -618,7 +618,7 @@ public void GetTypeByName_NoSuchType_ThrowsTypeLoadException(string typeName) }, typeName).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void GetTypeByNameCaseSensitiveTypeloadFailure() { RemoteInvokeOptions options = new RemoteInvokeOptions(); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs index 95a86a00ee424..57d529c80e5e6 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs @@ -535,7 +535,7 @@ public static void UnixCannotModifyDisallowedStore(bool useEnum, OpenFlags openF } } #if Unix - [ConditionalFact(nameof(NotRunningAsRoot))] // root can read '2.pem' + [ConditionalFact(nameof(NotRunningAsRootAndRemoteExecutorSupported))] // root can read '2.pem' [PlatformSpecific(TestPlatforms.Linux)] // Windows/OSX doesn't use SSL_CERT_{DIR,FILE}. private void X509Store_MachineStoreLoadSkipsInvalidFiles() { @@ -579,7 +579,7 @@ private void X509Store_MachineStoreLoadSkipsInvalidFiles() [DllImport("libc")] private static extern uint geteuid(); - public static bool NotRunningAsRoot => geteuid() != 0; + public static bool NotRunningAsRootAndRemoteExecutorSupported => geteuid() != 0 && RemoteExecutor.IsSupported; #endif } } diff --git a/src/libraries/System.Text.Encoding.CodePages/tests/EncoderFallbackBufferHelper.cs b/src/libraries/System.Text.Encoding.CodePages/tests/EncoderFallbackBufferHelper.cs index e30f248ae0297..e7575a343a252 100644 --- a/src/libraries/System.Text.Encoding.CodePages/tests/EncoderFallbackBufferHelper.cs +++ b/src/libraries/System.Text.Encoding.CodePages/tests/EncoderFallbackBufferHelper.cs @@ -73,7 +73,7 @@ public TestEncoderFallback(int expectedCharUnknown) public class EncoderFallbackBufferHelperTest { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Test_EncoderFallbackBufferHelper_ValidateFallbackForDataRoundTrips() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Cache.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Cache.Tests.cs index eee4af3a38e3a..d8fd053b745f8 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Cache.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Cache.Tests.cs @@ -37,7 +37,7 @@ public void CacheSize_Set_NegativeValue_ThrowsArgumentOutOfRangeException() AssertExtensions.Throws("value", () => Regex.CacheSize = -1); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_Cache_Second_drops_first() { RemoteExecutor.Invoke(() => @@ -49,7 +49,7 @@ public void Ctor_Cache_Second_drops_first() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_Cache_Shrink_cache() { RemoteExecutor.Invoke(() => @@ -65,7 +65,7 @@ public void Ctor_Cache_Shrink_cache() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_Cache_Promote_entries() { RemoteExecutor.Invoke(() => @@ -82,7 +82,7 @@ public void Ctor_Cache_Promote_entries() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_Cache_Uses_culture_and_options() { RemoteExecutor.Invoke(() => @@ -99,7 +99,7 @@ public void Ctor_Cache_Uses_culture_and_options() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void Ctor_Cache_Uses_dictionary_linked_list_switch_does_not_throw() { // assume the limit is less than the cache size so we cross it two times: diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs index aeab31dc21b80..60bae78c743cf 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs @@ -105,7 +105,7 @@ public static void Ctor_Invalid() AssertExtensions.Throws("matchTimeout", () => new Regex("foo", RegexOptions.None, TimeSpan.FromMilliseconds(int.MaxValue))); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void StaticCtor_InvalidTimeoutObject_ExceptionThrown() { RemoteExecutor.Invoke(() => @@ -115,7 +115,7 @@ public static void StaticCtor_InvalidTimeoutObject_ExceptionThrown() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void StaticCtor_InvalidTimeoutRange_ExceptionThrown() { RemoteExecutor.Invoke(() => @@ -190,7 +190,7 @@ public SerializableDerivedRegex() : base("") { } public SerializableDerivedRegex(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void Ctor_PatternInName() { diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index efd7b3cc7d8cc..10bff8d8a9ff0 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -505,7 +505,7 @@ public void Match_Timeout_Throws(RegexOptions options) Assert.Throws(() => new Regex(Pattern, options, TimeSpan.FromMilliseconds(100)).Match(input)); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(RegexOptions.None)] [InlineData(RegexOptions.None | (RegexOptions)0x80 /* Debug */)] [InlineData(RegexOptions.Compiled)] @@ -963,7 +963,9 @@ public void Match_SpecialUnicodeCharacters_Invariant() } } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArmProcess))] // times out on ARM + private static bool IsNotArmProcessAndRemoteExecutorSupported => PlatformDetection.IsNotArmProcess && RemoteExecutor.IsSupported; + + [ConditionalTheory(nameof(IsNotArmProcessAndRemoteExecutorSupported))] // times out on ARM [InlineData(RegexOptions.None)] [InlineData(RegexOptions.Compiled)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework does not have fix for https://github.com/dotnet/runtime/issues/24749")] diff --git a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/EtwTests.cs b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/EtwTests.cs index 5ba7362252b67..f6e8f2b524b94 100644 --- a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/EtwTests.cs +++ b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/EtwTests.cs @@ -11,7 +11,7 @@ namespace System.Threading.Tasks.Dataflow.Tests { public class EtwTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestEtw() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs b/src/libraries/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs index 2791dd074e460..1ce59fb80ca1f 100644 --- a/src/libraries/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs +++ b/src/libraries/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs @@ -556,7 +556,7 @@ static async ValueTask ValueTaskAsync(int i) })); } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("1", null)] [InlineData("true", null)] [InlineData("true", "1")] diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/EtwTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/EtwTests.cs index 82313c7b7ee70..9848154794177 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/EtwTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/EtwTests.cs @@ -13,7 +13,7 @@ namespace System.Threading.Tasks.Tests { public class EtwTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void TestEtw() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs b/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs index 94654fa2816f2..b02a457f5e529 100644 --- a/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs @@ -576,7 +576,7 @@ async Task YieldOnceAsync(object s) } [OuterLoop] - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void DroppedIncompleteStateMachine_RaisesIncompleteAsyncMethodEvent() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading.Thread/tests/ThreadTests.cs b/src/libraries/System.Threading.Thread/tests/ThreadTests.cs index 97356a400e7f3..16b502bed176e 100644 --- a/src/libraries/System.Threading.Thread/tests/ThreadTests.cs +++ b/src/libraries/System.Threading.Thread/tests/ThreadTests.cs @@ -182,7 +182,7 @@ public static void ApartmentState_AttributePresent(string appName, string testNa } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34543", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [PlatformSpecific(TestPlatforms.Windows)] public static void ApartmentState_NoAttributePresent_DefaultState_Windows() @@ -195,7 +195,7 @@ public static void ApartmentState_NoAttributePresent_DefaultState_Windows() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] public static void ApartmentState_NoAttributePresent_DefaultState_Unix() { @@ -206,8 +206,10 @@ public static void ApartmentState_NoAttributePresent_DefaultState_Unix() }).Dispose(); } + private static bool IsWindowsNanoServerAndRemoteExecutorSupported => PlatformDetection.IsWindowsNanoServer && RemoteExecutor.IsSupported; + // Thread is always initialized as MTA irrespective of the attribute present. - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsNanoServer))] + [ConditionalFact(nameof(IsWindowsNanoServerAndRemoteExecutorSupported))] public static void ApartmentState_NoAttributePresent_DefaultState_Nano() { RemoteExecutor.Invoke(() => @@ -217,7 +219,7 @@ public static void ApartmentState_NoAttributePresent_DefaultState_Nano() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] public static void ApartmentState_NoAttributePresent_STA_Unix() { @@ -488,7 +490,7 @@ public static void CurrentPrincipalContextFlowTest_NotFlow() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void CurrentPrincipal_SetNull() { // We run test on remote process because we need to set same principal policy @@ -651,7 +653,7 @@ public static void NameTest() }); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void ThreadNameDoesNotAffectProcessName() { // On Linux, changing the main thread name affects ProcessName. @@ -1120,7 +1122,7 @@ public static void MiscellaneousTest() Thread.Yield(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] public static void WindowsPrincipalPolicyTest_Windows() { @@ -1132,7 +1134,7 @@ public static void WindowsPrincipalPolicyTest_Windows() } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34543", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [PlatformSpecific(TestPlatforms.Windows)] public static void WindowsPrincipalPolicyTest_Windows_NewThreads() @@ -1163,7 +1165,7 @@ static void CheckPrincipal(object principal) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void NoPrincipalPolicyTest_NewThreads() { RemoteExecutor.Invoke(() => @@ -1182,7 +1184,7 @@ public static void NoPrincipalPolicyTest_NewThreads() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34543", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [PlatformSpecific(TestPlatforms.Windows)] public static void NoPrincipalToWindowsPrincipalPolicyTest_Windows_NewThreads() @@ -1212,7 +1214,7 @@ static void CheckPrincipal(object principal) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] public static void WindowsPrincipalPolicyTest_Unix() { @@ -1223,7 +1225,7 @@ public static void WindowsPrincipalPolicyTest_Unix() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void UnauthenticatedPrincipalTest() { RemoteExecutor.Invoke(() => @@ -1233,7 +1235,7 @@ public static void UnauthenticatedPrincipalTest() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void DefaultPrincipalPolicyTest() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs index a72fe059893d0..ffe0de0abf0af 100644 --- a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs +++ b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs @@ -559,7 +559,7 @@ public InvalidWorkItemAndTask(Action action) : base(action) { } public void Execute() { } } - [ConditionalFact(nameof(HasAtLeastThreeProcessors))] + [ConditionalFact(nameof(HasAtLeastThreeProcessorsAndRemoteExecutorSupported))] public void MetricsTest() { RemoteExecutor.Invoke(() => @@ -697,6 +697,6 @@ public void MetricsTest() }).Dispose(); } - public static bool HasAtLeastThreeProcessors => Environment.ProcessorCount >= 3; + public static bool HasAtLeastThreeProcessorsAndRemoteExecutorSupported => Environment.ProcessorCount >= 3 && RemoteExecutor.IsSupported; } } diff --git a/src/libraries/System.Threading.Timer/tests/TimerMetricsTests.cs b/src/libraries/System.Threading.Timer/tests/TimerMetricsTests.cs index c59d95b5f695a..137e31e975490 100644 --- a/src/libraries/System.Threading.Timer/tests/TimerMetricsTests.cs +++ b/src/libraries/System.Threading.Timer/tests/TimerMetricsTests.cs @@ -10,7 +10,7 @@ namespace System.Threading.Tests { public class TimerMetricsTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CountTest() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading/tests/EtwTests.cs b/src/libraries/System.Threading/tests/EtwTests.cs index f542961e160e2..14d80e484b19c 100644 --- a/src/libraries/System.Threading/tests/EtwTests.cs +++ b/src/libraries/System.Threading/tests/EtwTests.cs @@ -11,7 +11,7 @@ namespace System.Threading.Tests { public class EtwTests { - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestEtw() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Threading/tests/EventWaitHandleTests.cs b/src/libraries/System.Threading/tests/EventWaitHandleTests.cs index 2963891880769..e17f74686fa8e 100644 --- a/src/libraries/System.Threading/tests/EventWaitHandleTests.cs +++ b/src/libraries/System.Threading/tests/EventWaitHandleTests.cs @@ -177,7 +177,7 @@ public void OpenExisting_NameUsedByOtherSynchronizationPrimitive_Windows() } [PlatformSpecific(TestPlatforms.Windows)] // names aren't supported on Unix - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(EventResetMode.ManualReset)] [InlineData(EventResetMode.AutoReset)] public void PingPong(EventResetMode mode) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 1557a24f8a0da..b401ba963a700 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -400,7 +400,7 @@ public static IEnumerable CrossProcess_NamedMutex_ProtectedFileAccessA } } - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/36307", TestRuntimes.Mono)] [MemberData(nameof(CrossProcess_NamedMutex_ProtectedFileAccessAtomic_MemberData))] public void CrossProcess_NamedMutex_ProtectedFileAccessAtomic(string prefix) diff --git a/src/libraries/System.Threading/tests/SemaphoreTests.cs b/src/libraries/System.Threading/tests/SemaphoreTests.cs index f8af0363b3dfe..a740f5ab808ec 100644 --- a/src/libraries/System.Threading/tests/SemaphoreTests.cs +++ b/src/libraries/System.Threading/tests/SemaphoreTests.cs @@ -270,7 +270,7 @@ public void OpenExisting_SameAsOriginal_Windows(string name) } } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.Windows)] // names aren't supported on Unix public void PingPong() { diff --git a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs index 98b0659d9313e..9b15b8ec5efeb 100644 --- a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs +++ b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs @@ -40,7 +40,7 @@ protected void Dispose(bool disposing) /// /// This test case will verify various Async TransactionScope usage with task and async/await and also nested mixed mode(legacy TS and async TS) usage. /// - [Theory] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData(0)] [InlineData(1)] [InlineData(2)] From 2286618e412e6aab21b1b0d2767f5e741fe454ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Mon, 8 Jun 2020 23:50:35 +0200 Subject: [PATCH 2/2] Bump to latest RemoteExecutor package --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 511607bdcb10e..0c67465bb601c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -59,7 +59,7 @@ 5.0.0-beta.20280.1 2.5.1-beta.20280.1 5.0.0-beta.20280.1 - 5.0.0-beta.20304.3 + 5.0.0-beta.20308.5 5.0.0-beta.20280.1 5.0.0-preview.4.20202.18