Skip to content

WASM: Enable System.Threading.Tasks.Dataflow tests #38723

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

Merged
merged 1 commit into from
Jul 3, 2020
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public async Task TestSchedulerUsage()
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestInputCount()
{
foreach (bool sync in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -254,7 +254,7 @@ public async Task TestOrderMaintained()
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestNonGreedy()
{
foreach (bool sync in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -417,7 +417,7 @@ public async Task TestNullReturnedTasks()
actual: sumOfOdds);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestParallelExecution()
{
int dop = 2;
Expand All @@ -437,7 +437,7 @@ public async Task TestParallelExecution()
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestReleasingOfPostponedMessages()
{
foreach (bool sync in DataflowTestHelpers.BooleanValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public void TestLinkTo_ArgumentValidation()
Assert.Throws<ArgumentNullException>(() => source.LinkTo(target, null, i => true));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestLinkTo_TwoPhaseCommit()
{
var source1 = new BufferBlock<int>();
Expand All @@ -478,7 +478,7 @@ public void TestLinkTo_TwoPhaseCommit()
Assert.Equal(expected: 43, actual: tuple.Item2);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestLinkTo_DoubleLinking()
{
foreach (bool greedy in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -971,7 +971,7 @@ public async Task TestReceive_AlreadyAvailable()
Assert.Equal(expected: 0, actual: buffer.Count);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestReceive_NotYetAvailable()
{
var buffer = new BufferBlock<int>();
Expand Down Expand Up @@ -1028,7 +1028,7 @@ public async Task TestReceive_TimeoutZero()
}


[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestReceive_Cancellation()
{
var bb = new BufferBlock<int>();
Expand Down Expand Up @@ -1066,7 +1066,7 @@ public async Task TestReceive_Cancellation()
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestReceive_CanceledSource()
{
foreach (bool beforeReceive in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -1121,6 +1121,7 @@ public async Task TestReceiveAsync_ManyInOrder()
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // uses a lot of stack
Copy link
Member

Choose a reason for hiding this comment

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

Were this and TestOutputAvailableAsync_LongSequence the only ones to use a lot of the stack? Were there other indications that led to skipping the test with PlatformSpecific rather than ConditionalFact?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah and to be honest they didn't really show up during my testing on wasm but from a conversation I saw on Slack where @BrzVlad recommended we disable this test when using the interpreter so I figured wasm is in the same boat: https://xamarinhq.slack.com/archives/C03CELHQQ/p1593621506218500 😄

public async Task TestReceiveAsync_LongChain()
{
const int Length = 10000;
Expand Down Expand Up @@ -1706,7 +1707,7 @@ public void TestEncapsulate_ArgumentValidation()
() => DataflowBlock.Encapsulate<int, int>(new BufferBlock<int>(), new BufferBlock<int>()).Fault(null));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestEncapsulate_LinkingAndUnlinking()
{
var buffer = new BufferBlock<int>();
Expand Down Expand Up @@ -1921,6 +1922,7 @@ public async Task TestOutputAvailableAsync_DataAfterCompletion()
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // uses a lot of stack
public async Task TestOutputAvailableAsync_LongSequence()
{
const int iterations = 10000; // enough to stack overflow if there's a problem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace System.Threading.Tasks.Dataflow.Tests
{
public class DebugAttributeTests
{
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestDebuggerDisplaysAndTypeProxies()
{
// Test both canceled and non-canceled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void TestArgumentExceptions()
DataflowTestHelpers.TestArgumentsExceptions<Tuple<int, int, int>>(new JoinBlock<int, int, int>());
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
public async Task TestPostThenReceive()
{
const int Iters = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public async Task BufferBlocksToBatchNonGreedyToAction()
Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
public async Task BroadcastToActions()
{
var b = new BroadcastBlock<int>(i => i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public async Task TestCountZeroAtCompletion()
Assert.Equal(expected: 0, actual: tb.OutputCount);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestInputCount()
{
foreach (bool sync in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -635,7 +635,7 @@ public async Task TestOrdering_Async_OrderedDisabled()
await tb.Completion;
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestOrdering_Sync_OrderedDisabled()
{
// If ordering were enabled, this test would hang.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public async Task TestCountZeroAtCompletion()
Assert.Equal(expected: 0, actual: tb.OutputCount);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestInputCount()
{
foreach (bool sync in DataflowTestHelpers.BooleanValues)
Expand Down Expand Up @@ -748,7 +748,7 @@ public async Task TestOrdering_Async_OrderedDisabled(bool trustedEnumeration)
await tb.Completion;
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(true)]
[InlineData(false)]
public async Task TestOrdering_Sync_OrderedDisabled(bool trustedEnumeration)
Expand Down Expand Up @@ -776,7 +776,7 @@ public async Task TestOrdering_Sync_OrderedDisabled(bool trustedEnumeration)
await tb.Completion;
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task TestOrdering_Sync_BlockingEnumeration_NoDeadlock(bool ensureOrdered)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public async Task TestPostThenReceive()
await wob.Completion;
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestReceiveThenPost()
{
var wob = new WriteOnceBlock<int>(null);
Expand Down Expand Up @@ -207,7 +207,7 @@ public async Task TestTryReceiveWithFilter()
await wob.Completion;
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[Fact]
public async Task TestBroadcasting()
{
var wob = new WriteOnceBlock<int>(i => i + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Dataflow\ActionBlockTests.cs" />
<Compile Include="Dataflow\BatchBlockTests.cs" />
<Compile Include="Dataflow\BatchedJoinBlockTests.cs" />
Expand Down
8 changes: 4 additions & 4 deletions src/mono/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ app-builder:
$(DOTNET) build $(TOP)/tools-local/tasks/mobile.tasks/WasmAppBuilder

run-tests-v8-%:
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=V8
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=V8 $(MSBUILD_ARGS)
run-tests-sm-%:
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=SpiderMonkey
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=SpiderMonkey $(MSBUILD_ARGS)
run-tests-jsc-%:
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=JavaScriptCore
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) /p:JSEngine=JavaScriptCore $(MSBUILD_ARGS)

run-tests-%:
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG)
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) $(MSBUILD_ARGS)