Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/project/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<MicrosoftDotNetXUnitExtensionsVersion>5.0.0-beta.20280.1</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.20280.1</MicrosoftDotNetXUnitConsoleRunnerVersion>
<MicrosoftDotNetBuildTasksPackagingVersion>5.0.0-beta.20280.1</MicrosoftDotNetBuildTasksPackagingVersion>
<MicrosoftDotNetRemoteExecutorVersion>5.0.0-beta.20280.1</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftDotNetRemoteExecutorVersion>5.0.0-beta.20308.5</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftDotNetVersionToolsTasksVersion>5.0.0-beta.20280.1</MicrosoftDotNetVersionToolsTasksVersion>
<!-- Installer dependencies -->
<MicrosoftNETCoreAppVersion>5.0.0-preview.4.20202.18</MicrosoftNETCoreAppVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public async Task PostAsync_Post_ChannelBinding_ConfiguredCorrectly()
}
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[PlatformSpecific(TestPlatforms.Linux)]
public void HttpClientUsesSslCertEnvironmentVariables()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 7 additions & 3 deletions src/libraries/System.Buffers/tests/ArrayPool/CollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(() =>
Expand All @@ -418,7 +419,7 @@ public static void RentBufferFiresRentedDiagnosticEvent()
});
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void ReturnBufferFiresDiagnosticEvent()
{
RemoteInvokeWithTrimming(() =>
Expand All @@ -435,7 +436,7 @@ public static void ReturnBufferFiresDiagnosticEvent()
});
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent()
{
RemoteInvokeWithTrimming(() =>
Expand All @@ -445,7 +446,7 @@ public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent()
});
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent()
{
RemoteInvokeWithTrimming(() =>
Expand All @@ -455,7 +456,7 @@ public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent()
});
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void RentingManyBuffersFiresExpectedDiagnosticEvents()
{
RemoteInvokeWithTrimming(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand All @@ -49,7 +49,7 @@ public void ExecWait_OutputCaptured()
}).Dispose();
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ExecWaitWithCapture_NullNames_OutputCaptured()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -74,7 +74,7 @@ public void ExecWaitWithCapture_NullNames_OutputCaptured()
}).Dispose();
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ExecWaitWithCapture_SpecifiedNames_OutputCaptured()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -94,7 +94,7 @@ public void ExecWaitWithCapture_SpecifiedNames_OutputCaptured()
}).Dispose();
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ExecWaitWithCapture_CurrentDirectorySpecified_OutputIncludesSpecifiedDirectory()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -111,7 +111,7 @@ public void ExecWaitWithCapture_CurrentDirectorySpecified_OutputIncludesSpecifie
}).Dispose();
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ExecWaitWithCapture_OutputIncludesCurrentDirectory()
{
RemoteExecutor.Invoke(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace System.Collections.Concurrent.Tests
{
public class EtwTests
{
[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestEtw()
{
RemoteExecutor.Invoke(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public void Messsage_ShouldIncludeCountOfRootCauses()
}
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void Message_ShouldFormatCountOfRootCausesUsingTheCurrentCulture()
{
RemoteExecutor.Invoke(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand All @@ -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(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace System.Configuration.Tests
/// </summary>
public class CustomHostTests
{
[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Does not apply to .NET Framework.")]
public void FilePathIsPopulatedCorrectly()
{
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/System.Console/tests/CancelKeyPress.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@

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()
{
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()
{
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()
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Console/tests/CancelKeyPress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/libraries/System.Console/tests/ConsoleEncoding.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public partial class ConsoleEncoding
{
[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[PlatformSpecific(TestPlatforms.Windows)]
public void InputEncoding_SetDefaultEncoding_Success()
{
Expand All @@ -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()
{
Expand All @@ -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()
{
Expand All @@ -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()
{
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Console/tests/ConsoleEncoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand Down Expand Up @@ -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(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Console/tests/ReadKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void KeyAvailable()
}
}

[Fact]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void RedirectedConsole_ReadKey()
{
RunRemote(() => { Assert.Throws<InvalidOperationException>(() => Console.ReadKey()); return 42; }, new ProcessStartInfo() { RedirectStandardInput = true });
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/System.Console/tests/RedirectedStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Loading