Skip to content

Commit

Permalink
[wasm] Skip hanging System.Threading.Tasks.Extensions tests with Acti…
Browse files Browse the repository at this point in the history
…veIssue
  • Loading branch information
Mitchell Hwang committed Jul 8, 2020
1 parent 7287931 commit df224a9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ async ValueTask<int> ValueTaskReturningAsyncMethod(int result)
}
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public static async Task AwaitTasksAndValueTasks_InTaskAndValueTaskMethods()
{
for (int i = 0; i < 2; i++)
Expand Down Expand Up @@ -520,7 +521,8 @@ async ValueTask<int> ValueTaskInt32ReturningMethod()
}
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_ConcurrentBuilders_WorkCorrectly()
{
await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async _ =>
Expand All @@ -537,7 +539,8 @@ static async ValueTask ValueTaskAsync()
}));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_ConcurrentBuilders_WorkCorrectly()
{
await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace System.Threading.Tasks.Sources.Tests
{
public class ManualResetValueTaskSourceTests
{
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task ReuseInstanceWithResets_Success()
{
var mrvts = new ManualResetValueTaskSource<int>();
Expand Down Expand Up @@ -82,7 +83,8 @@ public async Task SetResult_BeforeOnCompleted_ResultAvailableSynchronously()
Assert.Equal(2, mrvts.Version);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task SetResult_AfterOnCompleted_ResultAvailableAsynchronously()
{
var mrvts = new ManualResetValueTaskSource<int>();
Expand Down Expand Up @@ -130,7 +132,8 @@ public async Task SetException_BeforeOnCompleted_ResultAvailableSynchronously()
Assert.Equal(2, mrvts.Version);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task SetException_AfterOnCompleted_ResultAvailableAsynchronously()
{
var mrvts = new ManualResetValueTaskSource<int>();
Expand Down Expand Up @@ -407,11 +410,12 @@ protected override void QueueTask(Task task)
protected override IEnumerable<Task> GetScheduledTasks() => null;
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(false, false)]
[InlineData(false, true)]
[InlineData(true, false)]
[InlineData(true, true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task AsyncEnumerable_Success(bool awaitForeach, bool asyncIterator)
{
IAsyncEnumerable<int> enumerable = asyncIterator ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,12 @@ public void Generic_CreateFromValueTaskSource_AsTaskNotIdempotent() // validates
Assert.NotSame(t.AsTask(), t.AsTask());
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_CreateFromValueTaskSource_Success(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask(sync ? ManualResetValueTaskSourceFactory.Completed(0) : ManualResetValueTaskSourceFactory.Delay(1, 0), 0);
Task t = vt.AsTask();
if (sync)
Expand All @@ -387,16 +383,12 @@ public async Task NonGeneric_CreateFromValueTaskSource_Success(bool sync)
await t;
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_CreateFromValueTaskSource_Success(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask<int>(sync ? ManualResetValueTaskSourceFactory.Completed(42) : ManualResetValueTaskSourceFactory.Delay(1, 42), 0);
Task<int> t = vt.AsTask();
if (sync)
Expand All @@ -406,16 +398,12 @@ public async Task Generic_CreateFromValueTaskSource_Success(bool sync)
Assert.Equal(42, await t);
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_CreateFromValueTaskSource_Faulted(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask(sync ? ManualResetValueTaskSourceFactory.Completed(0, new FormatException()) : ManualResetValueTaskSourceFactory.Delay(1, 0, new FormatException()), 0);
Task t = vt.AsTask();
if (sync)
Expand All @@ -429,16 +417,12 @@ public async Task NonGeneric_CreateFromValueTaskSource_Faulted(bool sync)
}
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_CreateFromValueTaskSource_Faulted(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask<int>(sync ? ManualResetValueTaskSourceFactory.Completed(0, new FormatException()) : ManualResetValueTaskSourceFactory.Delay(1, 0, new FormatException()), 0);
Task<int> t = vt.AsTask();
if (sync)
Expand All @@ -452,16 +436,12 @@ public async Task Generic_CreateFromValueTaskSource_Faulted(bool sync)
}
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_CreateFromValueTaskSource_Canceled(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask(sync ? ManualResetValueTaskSourceFactory.Completed(0, new OperationCanceledException()) : ManualResetValueTaskSourceFactory.Delay(1, 0, new OperationCanceledException()), 0);
Task t = vt.AsTask();
if (sync)
Expand All @@ -475,16 +455,12 @@ public async Task NonGeneric_CreateFromValueTaskSource_Canceled(bool sync)
}
}

[ConditionalTheory]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_CreateFromValueTaskSource_Canceled(bool sync)
{
if (!sync && !PlatformDetection.IsThreadingSupported)
{
throw new SkipTestException(nameof(PlatformDetection.IsThreadingSupported));
}

var vt = new ValueTask<int>(sync ? ManualResetValueTaskSourceFactory.Completed(0, new OperationCanceledException()) : ManualResetValueTaskSourceFactory.Delay(1, 0, new OperationCanceledException()), 0);
Task<int> t = vt.AsTask();
if (sync)
Expand Down Expand Up @@ -598,10 +574,11 @@ ValueTask<int> Create() =>
Assert.Equal(thread, Environment.CurrentManagedThreadId);
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(null)]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_CreateFromTask_Await_Normal(bool? continueOnCapturedContext)
{
var t = new ValueTask(Task.Delay(1));
Expand All @@ -612,10 +589,11 @@ public async Task NonGeneric_CreateFromTask_Await_Normal(bool? continueOnCapture
}
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(null)]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_CreateFromTask_Await_Normal(bool? continueOnCapturedContext)
{
var t = new ValueTask<int>(Task.Delay(1).ContinueWith(_ => 42));
Expand All @@ -626,10 +604,11 @@ public async Task Generic_CreateFromTask_Await_Normal(bool? continueOnCapturedCo
}
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(null)]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task CreateFromValueTaskSource_Await_Normal(bool? continueOnCapturedContext)
{
var mre = new ManualResetValueTaskSource<int>();
Expand All @@ -642,10 +621,11 @@ public async Task CreateFromValueTaskSource_Await_Normal(bool? continueOnCapture
}
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(null)]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_CreateFromValueTaskSource_Await_Normal(bool? continueOnCapturedContext)
{
var mre = new ManualResetValueTaskSource<int>();
Expand Down Expand Up @@ -829,12 +809,13 @@ await Task.Run(async () =>
});
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(CtorMode.Task, false)]
[InlineData(CtorMode.ValueTaskSource, false)]
[InlineData(CtorMode.Result, true)]
[InlineData(CtorMode.Task, true)]
[InlineData(CtorMode.ValueTaskSource, true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_Awaiter_ContinuesOnCapturedContext(CtorMode mode, bool sync)
{
await Task.Run(async () =>
Expand Down Expand Up @@ -862,7 +843,7 @@ await Task.Run(async () =>
});
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(CtorMode.Task, true, false)]
[InlineData(CtorMode.ValueTaskSource, true, false)]
[InlineData(CtorMode.Task, false, false)]
Expand All @@ -873,6 +854,7 @@ await Task.Run(async () =>
[InlineData(CtorMode.Result, false, true)]
[InlineData(CtorMode.Task, false, true)]
[InlineData(CtorMode.ValueTaskSource, false, true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task NonGeneric_ConfiguredAwaiter_ContinuesOnCapturedContext(CtorMode mode, bool continueOnCapturedContext, bool sync)
{
await Task.Run(async () =>
Expand Down Expand Up @@ -900,7 +882,7 @@ await Task.Run(async () =>
});
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Theory]
[InlineData(CtorMode.Task, true, false)]
[InlineData(CtorMode.ValueTaskSource, true, false)]
[InlineData(CtorMode.Task, false, false)]
Expand All @@ -911,6 +893,7 @@ await Task.Run(async () =>
[InlineData(CtorMode.Result, false, true)]
[InlineData(CtorMode.Task, false, true)]
[InlineData(CtorMode.ValueTaskSource, false, true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38931", TestPlatforms.Browser)]
public async Task Generic_ConfiguredAwaiter_ContinuesOnCapturedContext(CtorMode mode, bool continueOnCapturedContext, bool sync)
{
await Task.Run(async () =>
Expand Down

0 comments on commit df224a9

Please sign in to comment.