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 a4ef23333a97f..4133b5f3b2a02 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.20308.5
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 86ebfb436b57b..7a6fe144636e6 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 ead875c5c4f7e..61ff08ea334d5 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 f17dd8f84e1b5..639dd3b86c652 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()
}
}
- [Theory]
+ [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[InlineData(false)]
[InlineData(true)]
public void TestAsyncErrorStream_SynchronizingObject(bool invokeRequired)
@@ -87,7 +87,7 @@ public void TestAsyncErrorStream_SynchronizingObject(bool invokeRequired)
Assert.Equal(invokeRequired ? 3 : 0, invokeCalled);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestSyncOutputStream()
{
Process p = CreateProcessPortable(RemotelyInvokable.StreamBody);
@@ -98,7 +98,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)
@@ -124,7 +124,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
@@ -207,7 +207,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))
@@ -346,7 +346,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();
@@ -381,7 +381,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";
@@ -398,7 +398,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.
@@ -453,7 +453,7 @@ public void TestEOFReceivedWhenStdInClosed()
p1.Dispose();
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestAsyncHalfCharacterAtATime()
{
var receivedOutput = false;
@@ -494,7 +494,7 @@ public void TestAsyncHalfCharacterAtATime()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestManyOutputLines()
{
const int ExpectedLineCount = 144;
@@ -522,7 +522,7 @@ public void TestManyOutputLines()
Assert.Equal(ExpectedLineCount + 1, totalLinesReceived);
}
- [Theory]
+ [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[InlineData(false)]
[InlineData(true)]
public void TestManyOutputLines_SynchronizingObject(bool invokeRequired)
@@ -563,7 +563,7 @@ public void TestManyOutputLines_SynchronizingObject(bool invokeRequired)
Assert.Equal(invokeRequired ? totalLinesReceived : 0, invokeCalled);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[SkipOnCoreClr("Avoid asserts in FileStream.Read when concurrently disposed", ~RuntimeConfiguration.Release)]
public void TestClosingStreamsAsyncDoesNotThrow()
{
@@ -582,7 +582,7 @@ public void TestClosingStreamsAsyncDoesNotThrow()
RemotelyInvokable.FireClosedEvent();
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestClosingStreamsUndefinedDoesNotThrow()
{
Process p = CreateProcessPortable(RemotelyInvokable.WriteLinesAfterClose);
@@ -594,7 +594,7 @@ public void TestClosingStreamsUndefinedDoesNotThrow()
RemotelyInvokable.FireClosedEvent();
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestClosingSyncModeDoesNotCloseStreams()
{
Process p = CreateProcessPortable(RemotelyInvokable.WriteLinesAfterClose);
@@ -613,7 +613,7 @@ public void TestClosingSyncModeDoesNotCloseStreams()
error.ReadToEnd();
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestStreamNegativeTests()
{
{
@@ -662,7 +662,7 @@ public void TestStreamNegativeTests()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestCustomStandardInputEncoding()
{
var process = CreateProcessPortable(RemotelyInvokable.ReadLineWithCustomEncodingWriteLineWithUtf8, Encoding.UTF32.WebName);
@@ -683,7 +683,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 a3be3057e4d46..8931daac7b755 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)]
@@ -134,7 +134,7 @@ public void TestEnableRaiseEvents(bool? enable)
}
}
- [Theory]
+ [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[InlineData(false)]
[InlineData(true)]
public void TestExited_SynchronizingObject(bool invokeRequired)
@@ -288,8 +288,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()
{
@@ -354,7 +359,7 @@ public void ProcessStart_UseShellExecute_WorkingDirectory()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestExitCode()
{
{
@@ -371,7 +376,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
@@ -404,7 +409,7 @@ public void StartTime_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.StartTime);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestId()
{
CreateDefaultProcess();
@@ -420,7 +425,7 @@ public void TestId()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestHasExited()
{
{
@@ -461,7 +466,7 @@ public void Kill_NotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.Kill());
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestMachineName()
{
CreateDefaultProcess();
@@ -493,7 +498,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();
@@ -548,7 +553,7 @@ public void MaxValueWorkingSet_GetSetMacos_ThrowsPlatformSupportedException()
Assert.Throws(() => process.MaxWorkingSet = (IntPtr)1);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestMinWorkingSet()
{
CreateDefaultProcess();
@@ -620,7 +625,7 @@ public void TestModules()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestNonpagedSystemMemorySize64()
{
CreateDefaultProcess();
@@ -635,7 +640,7 @@ public void NonpagedSystemMemorySize64_GetNotStarted_ThrowsInvalidOperationExcep
Assert.Throws(() => process.NonpagedSystemMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPagedMemorySize64()
{
CreateDefaultProcess();
@@ -650,7 +655,7 @@ public void PagedMemorySize64_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.PagedMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPagedSystemMemorySize64()
{
CreateDefaultProcess();
@@ -665,7 +670,7 @@ public void PagedSystemMemorySize64_GetNotStarted_ThrowsInvalidOperationExceptio
Assert.Throws(() => process.PagedSystemMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakPagedMemorySize64()
{
CreateDefaultProcess();
@@ -680,7 +685,7 @@ public void PeakPagedMemorySize64_GetNotStarted_ThrowsInvalidOperationException(
Assert.Throws(() => process.PeakPagedMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakVirtualMemorySize64()
{
CreateDefaultProcess();
@@ -695,7 +700,7 @@ public void PeakVirtualMemorySize64_GetNotStarted_ThrowsInvalidOperationExceptio
Assert.Throws(() => process.PeakVirtualMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakWorkingSet64()
{
CreateDefaultProcess();
@@ -710,7 +715,7 @@ public void PeakWorkingSet64_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.PeakWorkingSet64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPrivateMemorySize64()
{
CreateDefaultProcess();
@@ -725,7 +730,7 @@ public void PrivateMemorySize64_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.PrivateMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestVirtualMemorySize64()
{
CreateDefaultProcess();
@@ -740,7 +745,7 @@ public void VirtualMemorySize64_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.VirtualMemorySize64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestWorkingSet64()
{
CreateDefaultProcess();
@@ -762,7 +767,7 @@ public void WorkingSet64_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.WorkingSet64);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestProcessorTime()
{
CreateDefaultProcess();
@@ -784,7 +789,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();
@@ -831,7 +836,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);
@@ -864,7 +869,7 @@ public void TestProcessStartTime()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ProcessStartTime_Deterministic_Across_Instances()
{
CreateDefaultProcess();
@@ -884,7 +889,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()
{
@@ -903,7 +908,7 @@ public void TestProcessorAffinity()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPriorityBoostEnabled()
{
CreateDefaultProcess();
@@ -932,7 +937,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();
@@ -968,7 +973,7 @@ public void PriorityClass_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.PriorityClass);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestProcessName()
{
CreateDefaultProcess();
@@ -985,7 +990,7 @@ public void ProcessName_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.ProcessName);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestSafeHandle()
{
CreateDefaultProcess();
@@ -993,7 +998,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)
@@ -1018,7 +1023,7 @@ public void SafeHandle_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.SafeHandle);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestSessionId()
{
CreateDefaultProcess();
@@ -1056,7 +1061,7 @@ public void TestGetCurrentProcess()
Assert.Equal(currentProcessId, current.Id);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestGetProcessById()
{
CreateDefaultProcess();
@@ -1265,7 +1270,7 @@ void TestRemoteProccess(Process remoteProcess)
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void StartInfo_GetFileName_ReturnsExpected()
{
Process process = CreateProcessLong();
@@ -1277,7 +1282,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();
@@ -1317,7 +1322,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")]
@@ -1432,7 +1437,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(() =>
@@ -1484,7 +1489,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()
{
@@ -1536,7 +1541,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()
{
@@ -1588,7 +1593,7 @@ public void MainWindowHandle_GetWithGui_ShouldRefresh_Windows()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void MainWindowTitle_NoWindow_ReturnsEmpty()
{
CreateDefaultProcess();
@@ -1605,7 +1610,7 @@ public void MainWindowTitle_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.MainWindowTitle);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void CloseMainWindow_NoWindow_ReturnsFalse()
{
CreateDefaultProcess();
@@ -1650,7 +1655,7 @@ public void Responding_GetNotStarted_ThrowsInvalidOperationException()
Assert.Throws(() => process.Responding);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestNonpagedSystemMemorySize()
{
CreateDefaultProcess();
@@ -1669,7 +1674,7 @@ public void NonpagedSystemMemorySize_GetNotStarted_ThrowsInvalidOperationExcepti
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPagedMemorySize()
{
CreateDefaultProcess();
@@ -1688,7 +1693,7 @@ public void PagedMemorySize_GetNotStarted_ThrowsInvalidOperationException()
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPagedSystemMemorySize()
{
CreateDefaultProcess();
@@ -1707,7 +1712,7 @@ public void PagedSystemMemorySize_GetNotStarted_ThrowsInvalidOperationException(
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakPagedMemorySize()
{
CreateDefaultProcess();
@@ -1726,7 +1731,7 @@ public void PeakPagedMemorySize_GetNotStarted_ThrowsInvalidOperationException()
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakVirtualMemorySize()
{
CreateDefaultProcess();
@@ -1745,7 +1750,7 @@ public void PeakVirtualMemorySize_GetNotStarted_ThrowsInvalidOperationException(
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPeakWorkingSet()
{
CreateDefaultProcess();
@@ -1764,7 +1769,7 @@ public void PeakWorkingSet_GetNotStarted_ThrowsInvalidOperationException()
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestPrivateMemorySize()
{
CreateDefaultProcess();
@@ -1783,7 +1788,7 @@ public void PrivateMemorySize_GetNotStarted_ThrowsInvalidOperationException()
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestVirtualMemorySize()
{
CreateDefaultProcess();
@@ -1802,7 +1807,7 @@ public void VirtualMemorySize_GetNotStarted_ThrowsInvalidOperationException()
#pragma warning restore 0618
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestWorkingSet()
{
CreateDefaultProcess();
@@ -1908,7 +1913,7 @@ public void Process_StartWithDuplicatePassword()
AssertExtensions.Throws(null, () => process.Start());
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestLongProcessIsWorking()
{
// Sanity check for CreateProcessLong
@@ -1975,7 +1980,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);
@@ -1987,7 +1992,7 @@ public void Start_StandardInputEncodingPropagatesToStreamWriter()
Assert.Same(encoding, process.StandardInput.Encoding);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartProcessWithArgumentList()
{
@@ -2011,7 +2016,7 @@ public void StartProcessWithArgumentList()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartProcessWithSameArgumentList()
{
@@ -2042,7 +2047,7 @@ public void StartProcessWithSameArgumentList()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void BothArgumentCtorAndArgumentListSet()
{
ProcessStartInfo psi = new ProcessStartInfo(GetCurrentProcessName(), "arg3");
@@ -2054,7 +2059,7 @@ public void BothArgumentCtorAndArgumentListSet()
Assert.Throws(() => testProcess.Start());
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void BothArgumentSetAndArgumentListSet()
{
ProcessStartInfo psi = new ProcessStartInfo(GetCurrentProcessName());
@@ -2103,7 +2108,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(() =>
@@ -2147,7 +2152,7 @@ int RunProcessAttemptingToKillEntireTreeOnParent()
}
}
- [Theory]
+ [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[InlineData(true)]
[InlineData(false)]
public void Kill_ExitedChildProcess_DoesNotThrow(bool killTree)
@@ -2160,7 +2165,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();
@@ -2193,7 +2198,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 e54663f81b8cb..1540f0bf4303a 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)
@@ -264,7 +264,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)]
@@ -281,7 +281,7 @@ public async Task SingleProcess_EnableRaisingEvents_CorrectExitCode(int exitCode
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void SingleProcess_CopiesShareExitInformation()
{
Process p = CreateProcessLong();
@@ -299,7 +299,7 @@ public void SingleProcess_CopiesShareExitInformation()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public async Task SingleProcess_CopiesShareExitAsyncInformation()
{
using Process p = CreateProcessLong();
@@ -333,7 +333,7 @@ public async Task SingleProcess_CopiesShareExitAsyncInformation()
}
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void WaitForPeerProcess()
{
Process child1 = CreateProcessLong();
@@ -359,7 +359,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();
@@ -397,7 +397,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";
@@ -443,7 +443,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";
@@ -492,7 +492,7 @@ public async Task WaitAsyncForSignal()
Assert.Equal(RemotelyInvokable.SuccessExitCode, p.ExitCode);
}
- [Fact]
+ [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void WaitChain()
{
Process root = CreateProcess(() =>
@@ -519,7 +519,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 () =>
@@ -565,7 +565,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);
@@ -574,7 +574,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);
@@ -587,7 +587,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 e291f4b1d4510..de27cbc5d92c1 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