Skip to content

Commit

Permalink
conditional tests
Browse files Browse the repository at this point in the history
Active Issue dotnet#98771
  • Loading branch information
pavelsavara committed Feb 21, 2024
1 parent 73e9c6a commit eae0342
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 35 deletions.
23 changes: 12 additions & 11 deletions eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,18 @@ jobs:
# ff tests are unstable currently
shouldContinueOnError: true

- template: /eng/pipelines/common/templates/wasm-debugger-tests.yml
parameters:
platforms:
- Browser_wasm
- Browser_wasm_win
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
nameSuffix: DebuggerTests_MultiThreaded
alwaysRun: ${{ parameters.isWasmOnlyBuild }}
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
runOnlyOnWasmOnlyPipelines: true
# Active Issue https://github.com/dotnet/runtime/issues/98771
# - template: /eng/pipelines/common/templates/wasm-debugger-tests.yml
# parameters:
# platforms:
# - Browser_wasm
# - Browser_wasm_win
# extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
# nameSuffix: DebuggerTests_MultiThreaded
# alwaysRun: ${{ parameters.isWasmOnlyBuild }}
# isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
# isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
# runOnlyOnWasmOnlyPipelines: true

# Disable for now
#- template: /eng/pipelines/coreclr/perf-wasm-jobs.yml
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Common/tests/System/TimeProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private static void CancelAfter(TimeProvider provider, CancellationTokenSource c
}
#endif // NETFRAMEWORK

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[MemberData(nameof(TimersProvidersListData))]
public static void CancellationTokenSourceWithTimer(TimeProvider provider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public static int SlowRuntimeTimeoutModifier
public static bool IsNotWasmThreadingSupported => !IsWasmThreadingSupported;
public static bool IsWasmBackgroundExec => IsBrowser && IsEnvironmentVariableTrue("IsWasmBackgroundExec");
public static bool IsWasmBackgroundExecOrSingleThread => IsWasmBackgroundExec || IsNotWasmThreadingSupported;
public static bool IsNotBrowserDeputyThread => IsWasmBackgroundExec || IsNotWasmThreadingSupported || !IsBrowser;
public static bool IsBinaryFormatterSupported => IsNotMobile && !IsNativeAot;

public static bool IsStartingProcessesSupported => !IsiOS && !IstvOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ public void CreateCallSite_EnumberableCachedAtLowestLevel(ServiceDescriptor[] de
Assert.Equal(typeof(IEnumerable<FakeService>), callSite.Cache.Key.ServiceIdentifier.ServiceType);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
public void CallSitesAreUniquePerServiceTypeAndSlot()
{
// Connected graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public void GetService_DisposeOnSameThread_Throws()
});
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
public void GetAsyncService_DisposeAsyncOnSameThread_ThrowsAndDoesNotHangAndDisposeAsyncGetsCalled()
{
// Arrange
Expand All @@ -398,7 +398,7 @@ public void GetAsyncService_DisposeAsyncOnSameThread_ThrowsAndDoesNotHangAndDisp
Assert.True(asyncDisposableResource.DisposeAsyncCalled);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
public void GetService_DisposeOnSameThread_ThrowsAndDoesNotHangAndDisposeGetsCalled()
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void BuildWebHostPattern_CanFindServiceProvider()
Assert.IsAssignableFrom<IServiceProvider>(factory(Array.Empty<string>()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BuildWebHostInvalidSignature.Program))]
public void BuildWebHostPattern__Invalid_CantFindWebHost()
{
Expand All @@ -46,7 +46,7 @@ public void BuildWebHostPattern__Invalid_CantFindWebHost()
Assert.Null(factory);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BuildWebHostInvalidSignature.Program))]
public void BuildWebHostPattern__Invalid_CantFindServiceProvider()
{
Expand All @@ -55,7 +55,7 @@ public void BuildWebHostPattern__Invalid_CantFindServiceProvider()
Assert.NotNull(factory);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateWebHostBuilderPatternTestSite.Program))]
public void CreateWebHostBuilderPattern_CanFindWebHostBuilder()
{
Expand All @@ -65,7 +65,7 @@ public void CreateWebHostBuilderPattern_CanFindWebHostBuilder()
Assert.IsAssignableFrom<IWebHostBuilder>(factory(Array.Empty<string>()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateWebHostBuilderPatternTestSite.Program))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(IWebHost))]
public void CreateWebHostBuilderPattern_CanFindServiceProvider()
Expand All @@ -85,7 +85,7 @@ public void CreateWebHostBuilderPattern__Invalid_CantFindWebHostBuilder()
Assert.Null(factory);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateWebHostBuilderInvalidSignature.Program))]
public void CreateWebHostBuilderPattern__InvalidReturnType_CanFindServiceProvider()
{
Expand All @@ -95,7 +95,7 @@ public void CreateWebHostBuilderPattern__InvalidReturnType_CanFindServiceProvide
Assert.Null(factory(Array.Empty<string>()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateHostBuilderPatternTestSite.Program))]
public void CreateHostBuilderPattern_CanFindHostBuilder()
{
Expand All @@ -105,7 +105,7 @@ public void CreateHostBuilderPattern_CanFindHostBuilder()
Assert.IsAssignableFrom<IHostBuilder>(factory(Array.Empty<string>()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateHostBuilderPatternTestSite.Program))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Host))]
public void CreateHostBuilderPattern_CanFindServiceProvider()
Expand All @@ -116,7 +116,7 @@ public void CreateHostBuilderPattern_CanFindServiceProvider()
Assert.IsAssignableFrom<IServiceProvider>(factory(Array.Empty<string>()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(CreateHostBuilderInvalidSignature.Program))]
public void CreateHostBuilderPattern__Invalid_CantFindHostBuilder()
{
Expand All @@ -135,7 +135,7 @@ public void CreateHostBuilderPattern__Invalid_CantFindServiceProvider()
Assert.Throws<InvalidOperationException>(() => factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPattern.Program))]
public void NoSpecialEntryPointPattern()
{
Expand All @@ -145,7 +145,7 @@ public void NoSpecialEntryPointPattern()
Assert.IsAssignableFrom<IServiceProvider>(factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPattern.Program))]
public void NoSpecialEntryPointPatternHostBuilderConfigureHostBuilderCallbackIsCalled()
{
Expand All @@ -163,7 +163,7 @@ void ConfigureHostBuilder(object hostBuilder)
Assert.True(called);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPattern.Program))]
public void NoSpecialEntryPointPatternBuildsThenThrowsCallsEntryPointCompletedCallback()
{
Expand All @@ -183,7 +183,7 @@ void EntryPointCompleted(Exception? exception)
Assert.Null(entryPointException);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPatternBuildsThenThrows.Program))]
public void NoSpecialEntryPointPatternBuildsThenThrowsCallsEntryPointCompletedCallbackWithException()
{
Expand All @@ -203,7 +203,7 @@ void EntryPointCompleted(Exception? exception)
Assert.NotNull(entryPointException);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPatternThrows.Program))]
public void NoSpecialEntryPointPatternThrows()
{
Expand All @@ -213,7 +213,7 @@ public void NoSpecialEntryPointPatternThrows()
Assert.Throws<Exception>(() => factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPatternExits.Program))]
public void NoSpecialEntryPointPatternExits()
{
Expand All @@ -223,7 +223,7 @@ public void NoSpecialEntryPointPatternExits()
Assert.Throws<InvalidOperationException>(() => factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPatternHangs.Program))]
public void NoSpecialEntryPointPatternHangs()
{
Expand All @@ -233,7 +233,7 @@ public void NoSpecialEntryPointPatternHangs()
Assert.Throws<InvalidOperationException>(() => factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPatternMainNoArgs.Program))]
public void NoSpecialEntryPointPatternMainNoArgs()
{
Expand All @@ -243,7 +243,7 @@ public void NoSpecialEntryPointPatternMainNoArgs()
Assert.IsAssignableFrom<IServiceProvider>(factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, "Program", "TopLevelStatements")]
public void TopLevelStatements()
{
Expand All @@ -254,7 +254,7 @@ public void TopLevelStatements()
Assert.IsAssignableFrom<IServiceProvider>(factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, "Program", "TopLevelStatementsTestsTimeout")]
public void TopLevelStatementsTestsTimeout()
{
Expand All @@ -265,7 +265,7 @@ public void TopLevelStatementsTestsTimeout()
Assert.Throws<InvalidOperationException>(() => factory(Array.Empty<string>()));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, "Program", "ApplicationNameSetFromArgument")]
public void ApplicationNameSetFromArgument()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public static void RentingReturningThenRentingABufferShouldNotAllocate()
Assert.Equal(id, bt.GetHashCode());
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDeputyThread))]
[MemberData(nameof(BytePoolInstances))]
public static void CanRentManySizedBuffers(ArrayPool<byte> pool)
{
Expand Down

0 comments on commit eae0342

Please sign in to comment.