From 538b12e696e0f980b4140eecdd102b916378550b Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 8 Sep 2022 17:59:57 +0200 Subject: [PATCH 01/12] Disable failing tests that make HTTP requests --- src/libraries/tests.proj | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 1defbf332910a..2ca3c846319e1 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -378,10 +378,19 @@ - + + + + + + + + + + From b2c2e48a9cfd388ee16cd649676d8d03be845fc8 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 8 Sep 2022 19:22:15 +0200 Subject: [PATCH 02/12] Fix eventpipe sample test --- .../Wasm.Browser.EventPipe.Sample.csproj | 6 ++++-- .../sample/wasm/browser-eventpipe/main.js | 21 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj b/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj index 57d89fd934304..d9c13925d5dc5 100644 --- a/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj +++ b/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj @@ -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)" }' /> diff --git a/src/mono/sample/wasm/browser-eventpipe/main.js b/src/mono/sample/wasm/browser-eventpipe/main.js index 36b13deddce7b..8c931537ab7ee 100644 --- a/src/mono/sample/wasm/browser-eventpipe/main.js +++ b/src/mono/sample/wasm/browser-eventpipe/main.js @@ -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)) @@ -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; @@ -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(); From e5352d16bacb615d72abcf98ae742591b17ae789 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 8 Sep 2022 19:27:00 +0200 Subject: [PATCH 03/12] Add missing issue links --- src/libraries/tests.proj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2ca3c846319e1..6ea3f13a2200b 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -382,14 +382,16 @@ - + + - + + From b8682fe2d71ffa1fadb92697e828f0e74c86fe72 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 9 Sep 2022 13:33:43 +0200 Subject: [PATCH 04/12] Bump pthread pool size for tests --- eng/pipelines/runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 08f41b85a35f3..ff05b9acf8c51 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -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 From e62090173657ff3348c1060f42d6114a233574af Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 9 Sep 2022 13:34:01 +0200 Subject: [PATCH 05/12] Disable failing test --- .../tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs index 7dcf4bdbfaebe..e4dde7a236f98 100644 --- a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs +++ b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs @@ -163,6 +163,7 @@ IAsyncEnumerable body(int i) } [Fact] + [ActiveIssue("TODO", TestPlatforms.Browser)] public async Task TestProducerConsumerAsyncEnumerable() { foreach (TaskScheduler scheduler in new[] { TaskScheduler.Default, new ConcurrentExclusiveSchedulerPair().ConcurrentScheduler }) From 9e2b82e2394418c5c2c6595136e75279b7c8000a Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 9 Sep 2022 15:33:34 +0200 Subject: [PATCH 06/12] Increase pthread pool size for CI --- eng/pipelines/runtime-extra-platforms-wasm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtime-extra-platforms-wasm.yml b/eng/pipelines/runtime-extra-platforms-wasm.yml index 466ffb12e8499..e657af4ad61c6 100644 --- a/eng/pipelines/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/runtime-extra-platforms-wasm.yml @@ -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 From a410b00ccca4e5236ee756790b6c53d2508e114e Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Sat, 10 Sep 2022 09:20:32 +0200 Subject: [PATCH 07/12] Try using diagnostics mock for the browser-eventpipe sample in Release mode on CI --- .../wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj b/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj index d9c13925d5dc5..42a4153a82fbe 100644 --- a/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj +++ b/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj @@ -18,7 +18,7 @@ - true + true From 865fdd04ab0e29145d027f93418bd68dd5d856df Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Sat, 10 Sep 2022 12:44:22 +0200 Subject: [PATCH 08/12] Update active issue link --- .../tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs index e4dde7a236f98..5fcc146b29d1d 100644 --- a/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs +++ b/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs @@ -163,7 +163,7 @@ IAsyncEnumerable body(int i) } [Fact] - [ActiveIssue("TODO", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/75389", TestPlatforms.Browser)] public async Task TestProducerConsumerAsyncEnumerable() { foreach (TaskScheduler scheduler in new[] { TaskScheduler.Default, new ConcurrentExclusiveSchedulerPair().ConcurrentScheduler }) From 1e5c88e131373eb1fd3e553071b2ceb21dce764b Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 12 Sep 2022 12:46:39 +0200 Subject: [PATCH 09/12] TMP add debugging information for CI --- src/mono/sample/wasm/browser-eventpipe/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mono/sample/wasm/browser-eventpipe/main.js b/src/mono/sample/wasm/browser-eventpipe/main.js index 8c931537ab7ee..4a2c16b75b429 100644 --- a/src/mono/sample/wasm/browser-eventpipe/main.js +++ b/src/mono/sample/wasm/browser-eventpipe/main.js @@ -16,14 +16,18 @@ async function doWork(startWork, stopWork, getIterationsDone) { btn.innerText = "Working"; document.getElementById("out").innerHTML = '...'; + console.log("TMP before delay..."); await delay(5000); // let it run for 5 seconds + console.log("TMP afeter delay"); document.getElementById("startWork").innerText = "Stopping"; document.getElementById("out").innerHTML = '... ...'; stopWork(); + console.log("TMP getting the answer ..."); const ret = await workPromise; // get the answer + console.log("TMP got the answer ..."); const iterations = getIterationsDone(); // get how many times the loop ran btn = document.getElementById("startWork"); @@ -45,30 +49,41 @@ function getOnClickHandler(startWork, stopWork, getIterationsDone) { const isTest = (config) => config.environmentVariables["CI_TEST"] === "true"; async function runTest({ StartAsyncWork, StopWork, GetIterationsDone }) { + console.log("TMP running test"); const result = await doWork(StartAsyncWork, StopWork, GetIterationsDone); + console.log("TMP done work"); const expectedResult = 55; // the default value of `inputN` is 10 (see index.html) return result === expectedResult; } async function main() { + console.log("TMP running main"); const { MONO, Module, getAssemblyExports, getConfig } = await dotnet .withElementOnExit() .withExitCodeLogging() .create(); + console.log("TMP created dotnet"); globalThis.__Module = Module; globalThis.MONO = MONO; + console.log("TMP getting exports"); const exports = await getAssemblyExports("Wasm.Browser.EventPipe.Sample.dll"); + console.log("TMP got exports"); + console.log("TMP setting up btn"); 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); + console.log("TMP set up btn"); const config = getConfig(); if (isTest(config)) { + console.log("TMP is test"); const succeeded = await runTest(exports.Sample.Test); + console.log("TMP exitting..."); exit(succeeded ? 0 : 1); + console.log("TMP exitted"); } } From a867ccac6f47b20a2068022952fbbc1be5d005fc Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 12 Sep 2022 14:36:25 +0200 Subject: [PATCH 10/12] Revert "TMP add debugging information for CI" This reverts commit 1e5c88e131373eb1fd3e553071b2ceb21dce764b. --- src/mono/sample/wasm/browser-eventpipe/main.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/mono/sample/wasm/browser-eventpipe/main.js b/src/mono/sample/wasm/browser-eventpipe/main.js index 4a2c16b75b429..8c931537ab7ee 100644 --- a/src/mono/sample/wasm/browser-eventpipe/main.js +++ b/src/mono/sample/wasm/browser-eventpipe/main.js @@ -16,18 +16,14 @@ async function doWork(startWork, stopWork, getIterationsDone) { btn.innerText = "Working"; document.getElementById("out").innerHTML = '...'; - console.log("TMP before delay..."); await delay(5000); // let it run for 5 seconds - console.log("TMP afeter delay"); document.getElementById("startWork").innerText = "Stopping"; document.getElementById("out").innerHTML = '... ...'; stopWork(); - console.log("TMP getting the answer ..."); const ret = await workPromise; // get the answer - console.log("TMP got the answer ..."); const iterations = getIterationsDone(); // get how many times the loop ran btn = document.getElementById("startWork"); @@ -49,41 +45,30 @@ function getOnClickHandler(startWork, stopWork, getIterationsDone) { const isTest = (config) => config.environmentVariables["CI_TEST"] === "true"; async function runTest({ StartAsyncWork, StopWork, GetIterationsDone }) { - console.log("TMP running test"); const result = await doWork(StartAsyncWork, StopWork, GetIterationsDone); - console.log("TMP done work"); const expectedResult = 55; // the default value of `inputN` is 10 (see index.html) return result === expectedResult; } async function main() { - console.log("TMP running main"); const { MONO, Module, getAssemblyExports, getConfig } = await dotnet .withElementOnExit() .withExitCodeLogging() .create(); - console.log("TMP created dotnet"); globalThis.__Module = Module; globalThis.MONO = MONO; - console.log("TMP getting exports"); const exports = await getAssemblyExports("Wasm.Browser.EventPipe.Sample.dll"); - console.log("TMP got exports"); - console.log("TMP setting up btn"); 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); - console.log("TMP set up btn"); const config = getConfig(); if (isTest(config)) { - console.log("TMP is test"); const succeeded = await runTest(exports.Sample.Test); - console.log("TMP exitting..."); exit(succeeded ? 0 : 1); - console.log("TMP exitted"); } } From e5690d8ef4dfadb526e40cb6812d8d4c72511715 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 13 Sep 2022 14:18:32 +0200 Subject: [PATCH 11/12] Decrease pthread pool size to just 8 --- eng/pipelines/runtime-extra-platforms-wasm.yml | 2 +- eng/pipelines/runtime.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/runtime-extra-platforms-wasm.yml b/eng/pipelines/runtime-extra-platforms-wasm.yml index e657af4ad61c6..c5f51aaecc820 100644 --- a/eng/pipelines/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/runtime-extra-platforms-wasm.yml @@ -107,7 +107,7 @@ jobs: - Browser_wasm #- Browser_wasm_win nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=16 + extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=8 isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} # Always run for runtime-wasm because tests are not run in runtime diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index ff05b9acf8c51..08f41b85a35f3 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -447,7 +447,7 @@ jobs: platforms: - Browser_wasm nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=16 + extraBuildArgs: /p:WasmEnableThreads=true alwaysRun: ${{ variables.isRollingBuild }} - template: /eng/pipelines/common/templates/wasm-build-only.yml From a40d262df5eda94a7b3f6dab33d594b222f07799 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 14 Sep 2022 00:40:49 +0000 Subject: [PATCH 12/12] [wasm] samples: use WasmXHarnessArgs so we can get the --web-server-use-cop argument --- src/mono/sample/wasm/DefaultBrowserSample.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mono/sample/wasm/DefaultBrowserSample.targets b/src/mono/sample/wasm/DefaultBrowserSample.targets index 1f11e12ccd1f0..33c52f98bda94 100644 --- a/src/mono/sample/wasm/DefaultBrowserSample.targets +++ b/src/mono/sample/wasm/DefaultBrowserSample.targets @@ -6,12 +6,12 @@ embedded 1 true - $(ExecXHarnessCmd) wasm test-browser --app=. --browser=Chrome $(XHarnessBrowserPathArg) --html-file=index.html --output-directory=$(XHarnessOutput) -- $(MSBuildProjectName).dll + $(ExecXHarnessCmd) wasm test-browser --app=. --browser=Chrome $(XHarnessBrowserPathArg) $(WasmXHarnessArgs) --html-file=index.html --output-directory=$(XHarnessOutput) -- $(MSBuildProjectName).dll - + - \ No newline at end of file +