Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUIC] Fix test for debug/release version of a library #93449

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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.");
Comment on lines +25 to 27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nitpicking, but since there's also 'checked' build possibility, I feel it might be better to check !IsDebugLibrary instead of IsReleaseLibrary (I see that implementation-wise this is the same, but it would make a bit more sense to me)

Suggested change
if (PlatformDetection.IsReleaseLibrary(typeof(QuicConnection).Assembly))
{
throw new SkipTestException("Retrieving SSL secrets is not supported in Release mode.");
if (!PlatformDetection.IsDebugLibrary(typeof(QuicConnection).Assembly))
{
throw new SkipTestException("Retrieving SSL secrets is supported only in Debug mode.");

Copy link
Member

@CarnaViire CarnaViire Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Baah, I spent too much time writing that 😂 you can disregard since this is merged already

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no "checked" version of library, that applies only to CLR.

}
Expand Down
Loading