Skip to content

Commit 348e06c

Browse files
authored
Disable tests on Debug CoreClr that are already disabled on Checked CoreClr (#64891)
* Disable tests on Debug CoreClr that are already disabled on Checked CoreClr * Increase Process timeout * Extract timeout modifier and make Debug only * Update src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs
1 parent 7aae884 commit 348e06c

File tree

25 files changed

+51
-31
lines changed

25 files changed

+51
-31
lines changed

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ public static partial class PlatformDetection
6060
public static bool Is64BitProcess => IntPtr.Size == 8;
6161
public static bool IsNotWindows => !IsWindows;
6262

63+
private static Lazy<bool> s_isCheckedRuntime => new Lazy<bool>(() => AssemblyConfigurationEquals("Checked"));
64+
private static Lazy<bool> s_isReleaseRuntime => new Lazy<bool>(() => AssemblyConfigurationEquals("Release"));
65+
private static Lazy<bool> s_isDebugRuntime => new Lazy<bool>(() => AssemblyConfigurationEquals("Debug"));
66+
67+
public static bool IsCheckedRuntime => s_isCheckedRuntime.Value;
68+
public static bool IsReleaseRuntime => s_isReleaseRuntime.Value;
69+
public static bool IsDebugRuntime => s_isDebugRuntime.Value;
70+
71+
// For use as needed on tests that time out when run on a Debug runtime.
72+
// Not relevant for timeouts on external activities, such as network timeouts.
73+
public static int SlowRuntimeTimeoutModifier = (PlatformDetection.IsDebugRuntime ? 5 : 1);
74+
6375
public static bool IsCaseInsensitiveOS => IsWindows || IsOSX || IsMacCatalyst;
6476

6577
#if NETCOREAPP
@@ -68,7 +80,7 @@ public static partial class PlatformDetection
6880
#else
6981
public static bool IsCaseSensitiveOS => !IsCaseInsensitiveOS;
7082
#endif
71-
83+
7284
public static bool IsThreadingSupported => !IsBrowser;
7385
public static bool IsBinaryFormatterSupported => IsNotMobile && !IsNativeAot;
7486
public static bool IsSymLinkSupported => !IsiOS && !IstvOS;
@@ -86,9 +98,9 @@ public static partial class PlatformDetection
8698
public static bool IsUsingLimitedCultures => !IsNotMobile;
8799
public static bool IsNotUsingLimitedCultures => IsNotMobile;
88100

89-
public static bool IsLinqExpressionsBuiltWithIsInterpretingOnly => s_LinqExpressionsBuiltWithIsInterpretingOnly.Value;
101+
public static bool IsLinqExpressionsBuiltWithIsInterpretingOnly => s_linqExpressionsBuiltWithIsInterpretingOnly.Value;
90102
public static bool IsNotLinqExpressionsBuiltWithIsInterpretingOnly => !IsLinqExpressionsBuiltWithIsInterpretingOnly;
91-
private static readonly Lazy<bool> s_LinqExpressionsBuiltWithIsInterpretingOnly = new Lazy<bool>(GetLinqExpressionsBuiltWithIsInterpretingOnly);
103+
private static readonly Lazy<bool> s_linqExpressionsBuiltWithIsInterpretingOnly = new Lazy<bool>(GetLinqExpressionsBuiltWithIsInterpretingOnly);
92104
private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly()
93105
{
94106
return !(bool)typeof(LambdaExpression).GetMethod("get_CanCompileToIL").Invoke(null, Array.Empty<object>());
@@ -203,7 +215,7 @@ private static bool GetAlpnSupport()
203215
{
204216
return true;
205217
}
206-
218+
207219
return OpenSslVersion.Major == 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2);
208220
}
209221

@@ -513,5 +525,13 @@ private static bool IsEnvironmentVariableTrue(string variableName)
513525
var val = Environment.GetEnvironmentVariable(variableName);
514526
return (val != null && val == "true");
515527
}
528+
529+
private static bool AssemblyConfigurationEquals(string configuration)
530+
{
531+
AssemblyConfigurationAttribute assemblyConfigurationAttribute = typeof(string).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();
532+
533+
return assemblyConfigurationAttribute != null &&
534+
string.Equals(assemblyConfigurationAttribute.Configuration, configuration, StringComparison.InvariantCulture);
535+
}
516536
}
517537
}

src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderAttributedOverrideUnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace System.ComponentModel.Composition.Registration.Tests
1212
{
13-
[SkipOnCoreClr("Test failures on stress tests", RuntimeConfiguration.Checked)]
13+
[SkipOnCoreClr("Test failures on stress tests", ~RuntimeConfiguration.Release)]
1414
[SkipOnMono("Test failures on stress tests")]
1515
public class RegistrationBuilderAttributedOverrideUnitTests
1616
{

src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace System.Diagnostics.Tests
1313
{
1414
public partial class ProcessTestBase : FileCleanupTestBase
1515
{
16-
protected const int WaitInMS = 30 * 1000;
16+
protected readonly int WaitInMS = 30 * 1000 * PlatformDetection.SlowRuntimeTimeoutModifier;
1717
protected Process _process;
1818
protected readonly List<Process> _processes = new List<Process>();
1919

src/libraries/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
namespace MonoTests.System.Drawing
4747
{
4848

49-
[SkipOnCoreClr("https://github.com/dotnet/runtime/issues/37082", TestPlatforms.AnyUnix, RuntimeConfiguration.Checked)]
49+
[SkipOnCoreClr("https://github.com/dotnet/runtime/issues/37082", TestPlatforms.AnyUnix, ~RuntimeConfiguration.Release)]
5050
public class TestBitmap
5151
{
5252

src/libraries/System.Linq.Expressions/tests/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
using Xunit;
55

6-
[assembly: SkipOnCoreClr("Long running tests: https://github.com/dotnet/runtime/issues/12927", RuntimeConfiguration.Checked)]
6+
[assembly: SkipOnCoreClr("Long running tests: https://github.com/dotnet/runtime/issues/12927", ~RuntimeConfiguration.Release)]

src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
using System;
55
using Xunit;
66

7-
[assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", RuntimeConfiguration.Checked)]
7+
[assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)]
88
[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/131", ~(TestPlatforms.Android | TestPlatforms.Browser), TargetFrameworkMonikers.Any, TestRuntimes.Mono)] // System.Net.Tests are flaky and/or long running
99

src/libraries/System.Net.HttpListener/tests/HttpListenerAuthenticationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace System.Net.Tests
1414
{
15-
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", RuntimeConfiguration.Checked)]
15+
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", ~RuntimeConfiguration.Release)]
1616
[ActiveIssue("https://github.com/dotnet/runtime/issues/2391", TestRuntimes.Mono)]
1717
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // httpsys component missing in Nano.
1818
public class HttpListenerAuthenticationTests : IDisposable

src/libraries/System.Net.HttpListener/tests/HttpListenerContextTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace System.Net.Tests
1515
{
16-
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", RuntimeConfiguration.Checked)]
16+
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", ~RuntimeConfiguration.Release)]
1717
[ActiveIssue("https://github.com/dotnet/runtime/issues/2391", TestRuntimes.Mono)]
1818
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // httpsys component missing in Nano.
1919
public class HttpListenerContextTests : IDisposable

src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace System.Net.Tests
1010
{
11-
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", RuntimeConfiguration.Checked)]
11+
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", ~RuntimeConfiguration.Release)]
1212
[ActiveIssue("https://github.com/dotnet/runtime/issues/2391", TestRuntimes.Mono)]
1313
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // httpsys component missing in Nano.
1414
public class HttpListenerResponseCookiesTests : HttpListenerResponseTestBase

src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected async Task<HttpListenerResponse> GetResponse(string httpVersion = "1.1
5656
}
5757
}
5858

59-
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", RuntimeConfiguration.Checked)]
59+
[SkipOnCoreClr("System.Net.Tests may timeout in stress configurations", ~RuntimeConfiguration.Release)]
6060
[ActiveIssue("https://github.com/dotnet/runtime/issues/2391", TestRuntimes.Mono)]
6161
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // httpsys component missing in Nano.
6262
public class HttpListenerResponseTests : HttpListenerResponseTestBase

0 commit comments

Comments
 (0)