Skip to content

Commit 06a85f0

Browse files
committed
Fix test for debug/release version of a library
1 parent dae5947 commit 06a85f0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public static bool IsPrivilegedProcess
103103
public static bool IsReleaseRuntime => s_isReleaseRuntime.Value;
104104
public static bool IsDebugRuntime => s_isDebugRuntime.Value;
105105

106+
public static bool IsReleaseLibrary(Assembly assembly) => !IsDebuggable(assembly);
107+
public static bool IsDebugLibrary(Assembly assembly) => IsDebuggable(assembly);
108+
106109
// For use as needed on tests that time out when run on a Debug runtime.
107110
// Not relevant for timeouts on external activities, such as network timeouts.
108111
public static int SlowRuntimeTimeoutModifier = (PlatformDetection.IsDebugRuntime ? 5 : 1);
@@ -661,6 +664,13 @@ private static bool AssemblyConfigurationEquals(string configuration)
661664
string.Equals(assemblyConfigurationAttribute.Configuration, configuration, StringComparison.InvariantCulture);
662665
}
663666

667+
private static bool IsDebuggable(Assembly assembly)
668+
{
669+
DebuggableAttribute debuggableAttribute = assembly.GetCustomAttribute<DebuggableAttribute>();
670+
671+
return debuggableAttribute != null && debuggableAttribute.IsJITTrackingEnabled;
672+
}
673+
664674
private static bool GetSupportsSha3()
665675
{
666676
if (IsOpenSslSupported)

src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicRemoteExecutorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public MsQuicRemoteExecutorTests()
2222
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
2323
public void SslKeyLogFile_IsCreatedAndFilled()
2424
{
25-
if (PlatformDetection.IsReleaseRuntime)
25+
if (PlatformDetection.IsReleaseLibrary(typeof(QuicConnection).Assembly))
2626
{
2727
throw new SkipTestException("Retrieving SSL secrets is not supported in Release mode.");
2828
}

0 commit comments

Comments
 (0)