Skip to content

Commit

Permalink
Fix test for debug/release version of a library (#93449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManickaP authored Oct 13, 2023
1 parent b9acf73 commit 7e118e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public static bool IsPrivilegedProcess
public static bool IsReleaseRuntime => s_isReleaseRuntime.Value;
public static bool IsDebugRuntime => s_isDebugRuntime.Value;

public static bool IsReleaseLibrary(Assembly assembly) => !IsDebuggable(assembly);
public static bool IsDebugLibrary(Assembly assembly) => IsDebuggable(assembly);

// For use as needed on tests that time out when run on a Debug runtime.
// Not relevant for timeouts on external activities, such as network timeouts.
public static int SlowRuntimeTimeoutModifier = (PlatformDetection.IsDebugRuntime ? 5 : 1);
Expand Down Expand Up @@ -661,6 +664,13 @@ private static bool AssemblyConfigurationEquals(string configuration)
string.Equals(assemblyConfigurationAttribute.Configuration, configuration, StringComparison.InvariantCulture);
}

private static bool IsDebuggable(Assembly assembly)
{
DebuggableAttribute debuggableAttribute = assembly.GetCustomAttribute<DebuggableAttribute>();

return debuggableAttribute != null && debuggableAttribute.IsJITTrackingEnabled;
}

private static bool GetSupportsSha3()
{
if (IsOpenSslSupported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public MsQuicRemoteExecutorTests()
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void SslKeyLogFile_IsCreatedAndFilled()
{
if (PlatformDetection.IsReleaseRuntime)
if (PlatformDetection.IsReleaseLibrary(typeof(QuicConnection).Assembly))
{
throw new SkipTestException("Retrieving SSL secrets is not supported in Release mode.");
}
Expand Down

0 comments on commit 7e118e7

Please sign in to comment.