Skip to content

Commit c3ab1cf

Browse files
authored
WASM: Enable System.Threading.Tasks.Dataflow tests (#38723)
With the recent async Tasks fix we can now skip just a handful of tests to get the testsuite to passing: `Tests run: 317, Errors: 0, Failures: 0, Skipped: 18. Time: 18.780363s`
1 parent d4f9424 commit c3ab1cf

11 files changed

+26
-33
lines changed

src/libraries/System.Threading.Tasks.Dataflow/tests/AssemblyInfo.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/ActionBlockTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public async Task TestSchedulerUsage()
197197
}
198198
}
199199

200-
[Fact]
200+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
201201
public async Task TestInputCount()
202202
{
203203
foreach (bool sync in DataflowTestHelpers.BooleanValues)
@@ -254,7 +254,7 @@ public async Task TestOrderMaintained()
254254
}
255255
}
256256

257-
[Fact]
257+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
258258
public async Task TestNonGreedy()
259259
{
260260
foreach (bool sync in DataflowTestHelpers.BooleanValues)
@@ -417,7 +417,7 @@ public async Task TestNullReturnedTasks()
417417
actual: sumOfOdds);
418418
}
419419

420-
[Fact]
420+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
421421
public async Task TestParallelExecution()
422422
{
423423
int dop = 2;
@@ -437,7 +437,7 @@ public async Task TestParallelExecution()
437437
}
438438
}
439439

440-
[Fact]
440+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
441441
public async Task TestReleasingOfPostponedMessages()
442442
{
443443
foreach (bool sync in DataflowTestHelpers.BooleanValues)

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DataflowBlockExtensionTests.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public void TestLinkTo_ArgumentValidation()
454454
Assert.Throws<ArgumentNullException>(() => source.LinkTo(target, null, i => true));
455455
}
456456

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

481-
[Fact]
481+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
482482
public async Task TestLinkTo_DoubleLinking()
483483
{
484484
foreach (bool greedy in DataflowTestHelpers.BooleanValues)
@@ -971,7 +971,7 @@ public async Task TestReceive_AlreadyAvailable()
971971
Assert.Equal(expected: 0, actual: buffer.Count);
972972
}
973973

974-
[Fact]
974+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
975975
public async Task TestReceive_NotYetAvailable()
976976
{
977977
var buffer = new BufferBlock<int>();
@@ -1028,7 +1028,7 @@ public async Task TestReceive_TimeoutZero()
10281028
}
10291029

10301030

1031-
[Fact]
1031+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
10321032
public async Task TestReceive_Cancellation()
10331033
{
10341034
var bb = new BufferBlock<int>();
@@ -1066,7 +1066,7 @@ public async Task TestReceive_Cancellation()
10661066
}
10671067
}
10681068

1069-
[Fact]
1069+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
10701070
public async Task TestReceive_CanceledSource()
10711071
{
10721072
foreach (bool beforeReceive in DataflowTestHelpers.BooleanValues)
@@ -1121,6 +1121,7 @@ public async Task TestReceiveAsync_ManyInOrder()
11211121
}
11221122

11231123
[Fact]
1124+
[PlatformSpecific(~TestPlatforms.Browser)] // uses a lot of stack
11241125
public async Task TestReceiveAsync_LongChain()
11251126
{
11261127
const int Length = 10000;
@@ -1706,7 +1707,7 @@ public void TestEncapsulate_ArgumentValidation()
17061707
() => DataflowBlock.Encapsulate<int, int>(new BufferBlock<int>(), new BufferBlock<int>()).Fault(null));
17071708
}
17081709

1709-
[Fact]
1710+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
17101711
public void TestEncapsulate_LinkingAndUnlinking()
17111712
{
17121713
var buffer = new BufferBlock<int>();
@@ -1921,6 +1922,7 @@ public async Task TestOutputAvailableAsync_DataAfterCompletion()
19211922
}
19221923

19231924
[Fact]
1925+
[PlatformSpecific(~TestPlatforms.Browser)] // uses a lot of stack
19241926
public async Task TestOutputAvailableAsync_LongSequence()
19251927
{
19261928
const int iterations = 10000; // enough to stack overflow if there's a problem

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DebugAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace System.Threading.Tasks.Dataflow.Tests
99
{
1010
public class DebugAttributeTests
1111
{
12-
[Fact]
12+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
1313
public void TestDebuggerDisplaysAndTypeProxies()
1414
{
1515
// Test both canceled and non-canceled

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/JoinBlockTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void TestArgumentExceptions()
7272
DataflowTestHelpers.TestArgumentsExceptions<Tuple<int, int, int>>(new JoinBlock<int, int, int>());
7373
}
7474

75-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
75+
[Fact]
7676
public async Task TestPostThenReceive()
7777
{
7878
const int Iters = 3;

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/SimpleNetworkTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public async Task BufferBlocksToBatchNonGreedyToAction()
169169
Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
170170
}
171171

172-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
172+
[Fact]
173173
public async Task BroadcastToActions()
174174
{
175175
var b = new BroadcastBlock<int>(i => i);

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformBlockTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public async Task TestCountZeroAtCompletion()
283283
Assert.Equal(expected: 0, actual: tb.OutputCount);
284284
}
285285

286-
[Fact]
286+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
287287
public void TestInputCount()
288288
{
289289
foreach (bool sync in DataflowTestHelpers.BooleanValues)
@@ -635,7 +635,7 @@ public async Task TestOrdering_Async_OrderedDisabled()
635635
await tb.Completion;
636636
}
637637

638-
[Fact]
638+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
639639
public async Task TestOrdering_Sync_OrderedDisabled()
640640
{
641641
// If ordering were enabled, this test would hang.

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public async Task TestCountZeroAtCompletion()
311311
Assert.Equal(expected: 0, actual: tb.OutputCount);
312312
}
313313

314-
[Fact]
314+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
315315
public void TestInputCount()
316316
{
317317
foreach (bool sync in DataflowTestHelpers.BooleanValues)
@@ -748,7 +748,7 @@ public async Task TestOrdering_Async_OrderedDisabled(bool trustedEnumeration)
748748
await tb.Completion;
749749
}
750750

751-
[Theory]
751+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
752752
[InlineData(true)]
753753
[InlineData(false)]
754754
public async Task TestOrdering_Sync_OrderedDisabled(bool trustedEnumeration)
@@ -776,7 +776,7 @@ public async Task TestOrdering_Sync_OrderedDisabled(bool trustedEnumeration)
776776
await tb.Completion;
777777
}
778778

779-
[Theory]
779+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
780780
[InlineData(false)]
781781
[InlineData(true)]
782782
public async Task TestOrdering_Sync_BlockingEnumeration_NoDeadlock(bool ensureOrdered)

src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/WriteOnceBlockTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public async Task TestPostThenReceive()
174174
await wob.Completion;
175175
}
176176

177-
[Fact]
177+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
178178
public async Task TestReceiveThenPost()
179179
{
180180
var wob = new WriteOnceBlock<int>(null);
@@ -207,7 +207,7 @@ public async Task TestTryReceiveWithFilter()
207207
await wob.Completion;
208208
}
209209

210-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
210+
[Fact]
211211
public async Task TestBroadcasting()
212212
{
213213
var wob = new WriteOnceBlock<int>(i => i + 1);

src/libraries/System.Threading.Tasks.Dataflow/tests/System.Threading.Tasks.Dataflow.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
55
</PropertyGroup>
66
<ItemGroup>
7-
<Compile Include="AssemblyInfo.cs" />
87
<Compile Include="Dataflow\ActionBlockTests.cs" />
98
<Compile Include="Dataflow\BatchBlockTests.cs" />
109
<Compile Include="Dataflow\BatchedJoinBlockTests.cs" />

0 commit comments

Comments
 (0)