Skip to content

Commit

Permalink
Skip GC pressure test when run under LUT
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Nov 6, 2019
1 parent 50fe4b6 commit 28ebc62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StreamJsonRpc.Tests/JsonRpcRemoteTargetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ public Task<T> InvokeAsync<T>(RequestId requestId, string targetName, object? ar

public class RemoteTargetOne
{
private static TaskCompletionSource<int> notificationTcs = new TaskCompletionSource<int>();

internal static readonly AsyncManualResetEvent CancellableRemoteOperationEntered = new AsyncManualResetEvent();

private static TaskCompletionSource<int> notificationTcs = new TaskCompletionSource<int>();

public static Task<int> NotificationReceived => notificationTcs.Task;

public static void GetOne()
Expand Down
1 change: 1 addition & 0 deletions src/StreamJsonRpc.Tests/JsonRpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public async Task ThrowsIfTargetNotSet()
public async Task InvokeWithProgressParameter_NoMemoryLeakConfirm()
{
Skip.If(this.clientMessageFormatter is MessagePackFormatter, "IProgress<T> serialization is not supported for MessagePack");
Skip.If(IsRunningUnderLiveUnitTest);
WeakReference weakRef = await this.InvokeWithProgressParameter_NoMemoryLeakConfirm_Helper();
GC.Collect();
Assert.False(weakRef.IsAlive);
Expand Down
3 changes: 3 additions & 0 deletions src/StreamJsonRpc.Tests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Threading;
Expand All @@ -17,6 +18,8 @@ public abstract class TestBase : IDisposable

protected static readonly CancellationToken PrecanceledToken = new CancellationToken(canceled: true);

protected static readonly bool IsRunningUnderLiveUnitTest = AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == "Microsoft.CodeAnalysis.LiveUnitTesting.Runtime");

private const int GCAllocationAttempts = 10;

private readonly CancellationTokenSource timeoutTokenSource;
Expand Down

0 comments on commit 28ebc62

Please sign in to comment.