Skip to content
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

[wasm-mt] Disable and fix remaining failing tests on Browser with multi-threading and perf tracing enabled #75286

Merged
Merged
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion eng/pipelines/runtime-extra-platforms-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- Browser_wasm
#- Browser_wasm_win
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true
extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=16
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
# Always run for runtime-wasm because tests are not run in runtime
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ jobs:
platforms:
- Browser_wasm
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true
extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=16
alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-build-only.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ IAsyncEnumerable<int> body(int i)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/75389", TestPlatforms.Browser)]
public async Task TestProducerConsumerAsyncEnumerable()
{
foreach (TaskScheduler scheduler in new[] { TaskScheduler.Default, new ConcurrentExclusiveSchedulerPair().ConcurrentScheduler })
Expand Down
13 changes: 12 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,21 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(WasmEnableThreads)' == 'true' and '$(RunDisabledWasmTests)' != 'true'">
<!-- https://github.com/dotnet/runtime/issues/72101 -->
<!-- Issue: https://github.com/dotnet/runtime/issues/72101 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.Tests\System.Text.Json.Tests.csproj" />
<!-- Issue: https://github.com/dotnet/runtime/issues/74411 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj" />
<!-- Issue: https://github.com/dotnet/runtime/issues/74413 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.WebSockets.Client\tests\System.Net.WebSockets.Client.Tests.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(WasmEnablePerfTracing)' == 'true' and '$(RunDisabledWasmTests)' != 'true'">
<!-- Issue: https://github.com/dotnet/runtime/issues/74411 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj" />
<!-- Issue: https://github.com/dotnet/runtime/issues/74413 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.WebSockets.Client\tests\System.Net.WebSockets.Client.Tests.csproj" />
</ItemGroup>

<!-- Aggressive Trimming related failures -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</Target>

<PropertyGroup>
<MonoDiagnosticsMock Condition="('$(MonoDiagnosticsMock)' == '') and ('$(Configuration)' == 'Debug')">true</MonoDiagnosticsMock>
<MonoDiagnosticsMock Condition="('$(MonoDiagnosticsMock)' == '') and ('$(Configuration)' == 'Debug' or '$(ArchiveTests)' == 'true')">true</MonoDiagnosticsMock>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,14 +29,16 @@
{
"MONO_LOG_LEVEL": "warning",
"MONO_LOG_MASK": "all",
"DOTNET_DiagnosticPorts": "ws://localhost:8088/diagnostics,suspend"
"DOTNET_DiagnosticPorts": "ws://localhost:8088/diagnostics,suspend",
"CI_TEST": "$(ArchiveTests)"
}' />
<!-- this option requires compiling the runtime with /p:MonoDiagnosticsMock=true and also building this project with the same property-->
<WasmExtraConfig Condition="'$(MonoDiagnosticsMock)' == 'true'" Include="environmentVariables" Value='
{
"MONO_LOG_LEVEL": "warning",
"MONO_LOG_MASK": "all",
"DOTNET_DiagnosticPorts": "mock:./mock.js,suspend"
"DOTNET_DiagnosticPorts": "mock:./mock.js,suspend",
"CI_TEST": "$(ArchiveTests)"
}' />
</ItemGroup>

Expand Down
21 changes: 19 additions & 2 deletions src/mono/sample/wasm/browser-eventpipe/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import { dotnet } from "./dotnet.js";
import { dotnet, exit } from "./dotnet.js";

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

Expand Down Expand Up @@ -43,8 +43,19 @@ function getOnClickHandler(startWork, stopWork, getIterationsDone) {
}
}

const isTest = (config) => config.environmentVariables["CI_TEST"] === "true";
async function runTest({ StartAsyncWork, StopWork, GetIterationsDone }) {
const result = await doWork(StartAsyncWork, StopWork, GetIterationsDone);
const expectedResult = 55; // the default value of `inputN` is 10 (see index.html)
return result === expectedResult;
}

async function main() {
const { MONO, Module, getAssemblyExports } = await dotnet.create()
const { MONO, Module, getAssemblyExports, getConfig } = await dotnet
.withElementOnExit()
.withExitCodeLogging()
.create();

globalThis.__Module = Module;
globalThis.MONO = MONO;

Expand All @@ -53,6 +64,12 @@ async function main() {
const btn = document.getElementById("startWork");
btn.style.backgroundColor = "rgb(192,255,192)";
btn.onclick = getOnClickHandler(exports.Sample.Test.StartAsyncWork, exports.Sample.Test.StopWork, exports.Sample.Test.GetIterationsDone);

const config = getConfig();
if (isTest(config)) {
const succeeded = await runTest(exports.Sample.Test);
exit(succeeded ? 0 : 1);
}
}

main();