From d07061767c09d3e9f484e4fbdbc445ab0034fbcc Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 7 Mar 2024 11:14:05 +0100 Subject: [PATCH 1/6] testing --- src/mono/browser/runtime/cancelable-promise.ts | 3 ++- src/mono/browser/runtime/gc-handles.ts | 1 + src/mono/browser/runtime/marshal-to-js.ts | 2 ++ src/mono/browser/runtime/marshal.ts | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/cancelable-promise.ts b/src/mono/browser/runtime/cancelable-promise.ts index eafa6bd7d3d4c7..52d34c7d51151d 100644 --- a/src/mono/browser/runtime/cancelable-promise.ts +++ b/src/mono/browser/runtime/cancelable-promise.ts @@ -8,7 +8,7 @@ import { createPromiseController, loaderHelpers, mono_assert } from "./globals"; import { ControllablePromise, GCHandle, MarshalerToCs } from "./types/internal"; import { ManagedObject } from "./marshal"; import { compareExchangeI32, forceThreadMemoryViewRefresh } from "./memory"; -import { mono_log_debug } from "./logging"; +import { mono_log_debug, mono_log_warn } from "./logging"; import { settleUnsettledPromise } from "./pthreads"; import { complete_task } from "./managed-exports"; import { marshal_cs_object_to_cs } from "./marshal-to-cs"; @@ -151,6 +151,7 @@ export class PromiseHolder extends ManagedObject { settleUnsettledPromise(); } + mono_log_warn("complete_task " + this.gc_handle); // we can unregister the GC handle just on JS side teardown_managed_proxy(this, this.gc_handle, /*skipManaged: */ true); // order of operations with teardown_managed_proxy matters diff --git a/src/mono/browser/runtime/gc-handles.ts b/src/mono/browser/runtime/gc-handles.ts index 3fc31717987fc1..60bbf61b7c8806 100644 --- a/src/mono/browser/runtime/gc-handles.ts +++ b/src/mono/browser/runtime/gc-handles.ts @@ -177,6 +177,7 @@ function _js_owned_object_finalized(gc_handle: GCHandle): void { // We're shutting down, so don't bother doing anything else. return; } + mono_log_warn("_js_owned_object_finalized " + gc_handle); teardown_managed_proxy(null, gc_handle); } diff --git a/src/mono/browser/runtime/marshal-to-js.ts b/src/mono/browser/runtime/marshal-to-js.ts index bee7d560c88903..36840c9fbd12ad 100644 --- a/src/mono/browser/runtime/marshal-to-js.ts +++ b/src/mono/browser/runtime/marshal-to-js.ts @@ -23,6 +23,7 @@ import { get_marshaler_to_cs_by_type, jsinteropDoc, marshal_exception_to_cs } fr import { localHeapViewF64, localHeapViewI32, localHeapViewU8 } from "./memory"; import { call_delegate } from "./managed-exports"; import { gc_locked } from "./gc-lock"; +import { mono_log_warn } from "./logging"; export function initialize_marshalers_to_js(): void { if (cs_to_js_marshalers.size == 0) { @@ -207,6 +208,7 @@ function _marshal_delegate_to_js(arg: JSMarshalerArgument, _?: MarshalerType, re result.dispose = () => { if (!result.isDisposed) { result.isDisposed = true; + mono_log_warn("_marshal_delegate_to_js " + gc_handle); teardown_managed_proxy(result, gc_handle); } }; diff --git a/src/mono/browser/runtime/marshal.ts b/src/mono/browser/runtime/marshal.ts index 35e001c8665e03..1ae4ffd5c73413 100644 --- a/src/mono/browser/runtime/marshal.ts +++ b/src/mono/browser/runtime/marshal.ts @@ -11,6 +11,7 @@ import { GCHandle, JSHandle, MonoObject, MonoString, GCHandleNull, JSMarshalerAr import { TypedArray, VoidPtr } from "./types/emscripten"; import { utf16ToString } from "./strings"; import { get_managed_stack_trace } from "./managed-exports"; +import { mono_log_warn } from "./logging"; export const cs_to_js_marshalers = new Map(); export const js_to_cs_marshalers = new Map(); @@ -373,6 +374,7 @@ export interface IDisposable { export class ManagedObject implements IDisposable { dispose(): void { + mono_log_warn("ManagedObject.dispose " + (this)[js_owned_gc_handle_symbol]); teardown_managed_proxy(this, GCHandleNull); } @@ -428,6 +430,7 @@ export class ManagedError extends Error implements IDisposable { } dispose(): void { + mono_log_warn("ManagedError.dispose " + (this)[js_owned_gc_handle_symbol]); teardown_managed_proxy(this, GCHandleNull); } @@ -556,6 +559,7 @@ export class ArraySegment extends MemoryView { } dispose(): void { + mono_log_warn("ArraySegment.dispose " + (this)[js_owned_gc_handle_symbol]); teardown_managed_proxy(this, GCHandleNull); } From 62f511b5e744c9894ba3368ec603fd06c21e0a11 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 7 Mar 2024 12:36:05 +0100 Subject: [PATCH 2/6] wip --- eng/pipelines/runtime.yml | 1495 ----------------- .../scenarios/BuildWasmAppsJobsList.txt | 47 - .../BlazorHosted.Client/Pages/Chat.razor | 4 + 3 files changed, 4 insertions(+), 1542 deletions(-) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index d7a1f1847eb11a..76efd6b5953fb8 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -66,439 +66,6 @@ extends: - ${{ if eq(variables.dependOnEvaluatePaths, true) }}: - template: /eng/pipelines/common/evaluate-default-paths.yml - # - # Build CoreCLR checked - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml - buildConfig: checked - platforms: - - linux_x64 - - linux_arm - - linux_arm64 - - linux_riscv64 - - linux_musl_arm - - linux_musl_arm64 - - linux_musl_x64 - - osx_arm64 - - windows_x86 - - windows_x64 - - windows_arm64 - jobParameters: - testGroup: innerloop - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build the whole product using GNU compiler toolchain - # When CoreCLR, Mono, Libraries, Installer and src/tests are changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: checked - platforms: - - gcc_linux_x64 - jobParameters: - testGroup: innerloop - nameSuffix: Native_GCC - buildArgs: -s clr.native+libs.native+mono+host.native -c $(_BuildConfig) -gcc - postBuildSteps: - - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests.yml - parameters: - testBuildArgs: skipmanaged skipgeneratelayout skiprestorepackages -gcc - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build CoreCLR osx_x64 checked - # Only when CoreCLR or Libraries is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml - buildConfig: checked - platforms: - - osx_x64 - jobParameters: - testGroup: innerloop - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build CoreCLR release - # Always as they are needed by Installer and we always build and test the Installer. - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml - buildConfig: release - platforms: - - osx_arm64 - - osx_x64 - - linux_x64 - - linux_arm - - linux_arm64 - - linux_musl_x64 - - linux_musl_arm - - linux_musl_arm64 - - windows_x64 - - windows_x86 - - windows_arm64 - - freebsd_x64 - jobParameters: - testGroup: innerloop - # Mono/runtimetests also need this, but skip for wasm - condition: - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build CoreCLR Formatting Job - # Only when CoreCLR is changed, and only in the 'main' branch (no release branches; - # both Rolling and PR builds). - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/format-job.yml - platforms: - - linux_x64 - - windows_x64 - jobParameters: - condition: >- - and( - or( - eq(variables['Build.SourceBranchName'], 'main'), - eq(variables['System.PullRequest.TargetBranch'], 'main')), - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr_jit.containsChange'], true), - eq(variables['isRollingBuild'], true))) - - # - # Build CoreCLR with no R2R - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: checked - runtimeFlavor: coreclr - platforms: - - linux_x86 - jobParameters: - testScope: innerloop - nameSuffix: CoreCLR_NoR2R - buildArgs: -s clr.runtime+clr.jit+clr.iltools+clr.spmi+clr.corelib -c $(_BuildConfig) - timeoutInMinutes: 120 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build CoreCLR as a non-portable build - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: checked - runtimeFlavor: coreclr - platforms: - - tizen_armel - jobParameters: - testScope: innerloop - nameSuffix: CoreCLR_NonPortable - buildArgs: -s clr.native+clr.tools+clr.corelib+clr.nativecorelib+clr.aot+clr.packages -c $(_BuildConfig) /p:PortableBuild=false - timeoutInMinutes: 120 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR NativeAOT debug build and smoke tests - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Debug - platforms: - - linux_x64 - - windows_x64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - timeoutInMinutes: 120 - nameSuffix: NativeAOT - buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release /p:RunAnalyzers=false - postBuildSteps: - - template: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml - parameters: - creator: dotnet-bot - testBuildArgs: nativeaot tree nativeaot - liveLibrariesBuildConfig: Release - testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig) - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - parameters: - testGroup: innerloop - liveLibrariesBuildConfig: Release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR NativeAOT checked build and smoke tests - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Checked - platforms: - - windows_x64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - timeoutInMinutes: 180 - nameSuffix: NativeAOT - buildArgs: -s clr.aot+host.native+libs.native+libs.sfx -rc $(_BuildConfig) -lc Release -hc Release /p:RunAnalyzers=false - postBuildSteps: - - template: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml - parameters: - creator: dotnet-bot - testBuildArgs: 'nativeaot tree ";nativeaot;Loader;Interop;" /p:BuildNativeAotFrameworkObjects=true' - liveLibrariesBuildConfig: Release - testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig) - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - parameters: - testGroup: innerloop - liveLibrariesBuildConfig: Release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR NativeAOT release build and smoke tests - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Release - platforms: - - linux_x64 - - windows_x64 - - osx_x64 - - linux_arm64 - - windows_arm64 - - osx_arm64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - testGroup: innerloop - timeoutInMinutes: 120 - nameSuffix: NativeAOT - buildArgs: -s clr.aot+host.native+libs+tools.illink -c $(_BuildConfig) -rc $(_BuildConfig) -lc Release -hc Release /p:RunAnalyzers=false - postBuildSteps: - - template: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml - parameters: - creator: dotnet-bot - testBuildArgs: 'nativeaot tree ";nativeaot;tracing/eventpipe/providervalidation;"' - liveLibrariesBuildConfig: Release - testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig) - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - parameters: - testGroup: innerloop - liveLibrariesBuildConfig: Release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR NativeAOT release build and libraries tests - # Only when CoreCLR or library is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: Release - platforms: - - windows_arm64 - - linux_arm64 - - osx_arm64 - jobParameters: - testGroup: innerloop - isSingleFile: true - nameSuffix: NativeAOT_Libraries - buildArgs: -s clr.aot+host.native+libs+libs.tests -c $(_BuildConfig) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true /p:ArchiveTests=true /p:RunAnalyzers=false - timeoutInMinutes: 240 # Doesn't actually take long, but we've seen the ARM64 Helix queue often get backlogged for 2+ hours - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig) - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # Build and test clr tools - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: checked - platforms: - - linux_x64 - jobParameters: - timeoutInMinutes: 120 - nameSuffix: CLR_Tools_Tests - buildArgs: -s clr.aot+clr.iltools+libs.sfx+clr.toolstests -c $(_BuildConfig) -test - enablePublishTestResults: true - testResultsFormat: 'xunit' - # We want to run AOT tests when illink changes because there's share code and tests from illink which are used by AOT - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # - # Build CrossDacs - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: release - platforms: - - windows_x64 - variables: - - name: _archParameter - value: -arch x64,x86,arm,arm64 - jobParameters: - buildArgs: -s linuxdac+alpinedac -c Checked,$(_BuildConfig) - nameSuffix: CrossDac - isOfficialBuild: false - timeoutInMinutes: 60 - postBuildSteps: - - publish: $(Build.SourcesDirectory)/artifacts/bin/coreclr - displayName: Publish CrossDacs for diagnostics - artifact: CoreCLRCrossDacArtifacts - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # Build Mono AOT offset headers once, for consumption elsewhere - # Only when mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/generate-offsets.yml - buildConfig: release - platforms: - - android_x64 - - browser_wasm - - wasi_wasm - - tvos_arm64 - - ios_arm64 - - maccatalyst_x64 - jobParameters: - isOfficialBuild: false - # needed by crossaot - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # Build the whole product using Mono runtime - # Only when libraries, mono or installer are changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - runtimeFlavor: mono - platforms: - - tvossimulator_x64 - - linux_arm - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - linux_musl_x64 - - linux_riscv64 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # # WebAssembly legs # @@ -535,31 +102,6 @@ extends: - WasmTestOnBrowser #- WasmTestOnNodeJS - this is not supported yet, https://github.com/dotnet/runtime/issues/85592 - # EAT Library tests - only run on linux - - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml - parameters: - platforms: - - browser_wasm - nameSuffix: _EAT - runAOT: false - shouldRunSmokeOnly: false - alwaysRun: ${{ variables.isRollingBuild }} - extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) /maxcpucount:2 - - # AOT Library tests - - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - - wasi_wasm - - wasi_wasm_win - nameSuffix: _Smoke_AOT - runAOT: true - shouldRunSmokeOnly: true - alwaysRun: ${{ variables.isRollingBuild }} - extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # For Wasm.Build.Tests - runtime pack builds - template: /eng/pipelines/common/templates/wasm-build-only.yml parameters: @@ -592,15 +134,6 @@ extends: alwaysRun: ${{ variables.isRollingBuild }} extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # Wasm Debugger tests - - template: /eng/pipelines/common/templates/wasm-debugger-tests.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - alwaysRun: ${{ variables.isRollingBuild }} - extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # Wasm runtime tests - template: /eng/pipelines/common/templates/wasm-runtime-tests.yml parameters: @@ -609,1031 +142,3 @@ extends: alwaysRun: ${{ variables.isRollingBuild }} extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # WASI/WASM - - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - nameSuffix: '_Smoke' - extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - shouldRunSmokeOnly: true - alwaysRun: ${{ variables.isRollingBuild }} - scenarios: - - normal - - - template: /eng/pipelines/common/templates/simple-wasm-build-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - alwaysRun: ${{ variables.isRollingBuild }} - - # - # Android devices - # Build the whole product using Mono and run libraries tests - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - android_arm - - android_arm64 - variables: - # map dependencies variables to local variables - - name: librariesContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] - - name: monoContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'] ] - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:EnableAdditionalTimezoneChecks=true - timeoutInMinutes: 480 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size - # Build the whole product using Mono and run libraries tests - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - ios_arm64 - - tvos_arm64 - variables: - # map dependencies variables to local variables - - name: librariesContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] - - name: monoContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'] ] - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:RunSmokeTestsOnly=true /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true - timeoutInMinutes: 480 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # iOS/tvOS devices - # Build the whole product using Native AOT and run libraries tests - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: coreclr - platforms: - - ios_arm64 - - tvos_arm64 - variables: - # map dependencies variables to local variables - - name: librariesContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] - - name: coreclrContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ] - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_NativeAOT - buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=- /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true - timeoutInMinutes: 180 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig) - extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['coreclrContainsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # MacCatalyst interp - requires AOT Compilation and Interp flags - # Build the whole product using Mono and run libraries tests - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - maccatalyst_x64 - - ${{ if eq(variables['isRollingBuild'], true) }}: - - maccatalyst_arm64 - variables: - # map dependencies variables to local variables - - name: librariesContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] - - name: monoContainsChange - value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'] ] - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=adhoc /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildDarwinFrameworks=true - timeoutInMinutes: 180 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono and Installer on LLVMJIT mode - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - osx_x64 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_LLVMJIT - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=false - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - runtimeFlavor: mono - platforms: - - linux_x64 - - linux_arm64 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_LLVMJIT - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=false - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono and Installer on LLVMAOT mode - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - linux_x64 - - linux_arm64 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_LLVMAOT - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - /p:MonoEnableLLVM=true /p:MonoAOTEnableLLVM=true /p:MonoBundleLLVMOptimizer=true - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - runtimeFlavor: mono - platforms: - - osx_x64 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_LLVMAOT - buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) - /p:MonoEnableLLVM=true /p:MonoAOTEnableLLVM=true /p:MonoBundleLLVMOptimizer=true - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono debug - # Only when mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: debug - platforms: - - osx_x64 - - osx_arm64 - - linux_x64 - - linux_arm64 - # - linux_musl_arm64 - - windows_x64 - - windows_x86 - # - windows_arm64 - jobParameters: - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono release AOT cross-compilers - # Only when mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: release - platforms: - - linux_x64 - - linux_musl_x64 - - linux_arm64 - - linux_musl_arm64 - - windows_arm64 - - windows_x64 - jobParameters: - runtimeVariant: crossaot - dependsOn: - - mono_android_offsets - - mono_browser_offsets - - mono_wasi_offsets - monoCrossAOTTargetOS: - - android - - browser - - wasi - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: release - platforms: - - osx_x64 - - osx_arm64 - jobParameters: - runtimeVariant: crossaot - dependsOn: - - mono_android_offsets - - mono_browser_offsets - - mono_wasi_offsets - - mono_tvos_offsets - - mono_ios_offsets - - mono_maccatalyst_offsets - monoCrossAOTTargetOS: - - android - - browser - - wasi - - tvos - - ios - - maccatalyst - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono release - # Only when libraries or mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: release - platforms: - - linux_x64 - # - linux_musl_arm64 - - windows_x64 - - windows_x86 - # - windows_arm64 - jobParameters: - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono release - # Only when libraries, mono, or the runtime tests changed - # Currently only these architectures are needed for the runtime tests. - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: release - platforms: - - osx_x64 - - linux_arm64 - jobParameters: - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build Mono release with LLVM AOT - # Only when mono, or the runtime tests changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/mono/templates/build-job.yml - runtimeFlavor: mono - buildConfig: release - platforms: - - linux_x64 - - linux_arm64 - jobParameters: - runtimeVariant: llvmaot - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build libraries using live CoreLib - # These set of libraries are built always no matter what changed - # The reason for that is because Corelib and Installer needs it and - # These are part of the test matrix for Libraries changes. - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml - buildConfig: Release - platforms: - - linux_arm - - linux_musl_arm - - linux_musl_arm64 - - windows_arm64 - - windows_x86 - jobParameters: - condition: - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - linux_arm64 - - linux_musl_x64 - - linux_x64 - - osx_arm64 - - osx_x64 - - windows_x64 - - freebsd_x64 - jobParameters: - testScope: innerloop - condition: - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Libraries debug build that only runs when coreclr is changed - # Only do this on PR builds since we use the Release builds for these test runs in CI - # and those are already built above - # - - ${{ if eq(variables['isRollingBuild'], false) }}: - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml - buildConfig: Debug - platforms: - - windows_x86 - jobParameters: - condition: >- - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true) - - # - # Libraries release build that only runs when coreclr is changed in PRs - # We need these for checked coreclr + release libraries tests runs. - # - - ${{ if eq(variables['isRollingBuild'], false) }}: - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml - buildConfig: Release - platforms: - - linux_x64 - - windows_x64 - jobParameters: - condition: >- - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true) - - # - # Build and test libraries for .NET Framework - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - platforms: - - windows_x86 - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - jobParameters: - framework: net48 - buildArgs: -s tools+libs+libs.tests -framework net48 -c $(_BuildConfig) -testscope innerloop /p:ArchiveTests=true - nameSuffix: Libraries_NET48 - timeoutInMinutes: 150 - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: NET48_$(_BuildConfig) - extraHelixArguments: /p:BuildTargetFramework=net48 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build and test libraries AllConfigurations - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - windows_x64 - jobParameters: - buildArgs: -test -s tools+libs+libs.tests -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true - nameSuffix: Libraries_AllConfigurations - timeoutInMinutes: 150 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Installer Build and Test - # These are always built since they only take like 15 minutes - # we expect these to be done before we finish libraries or coreclr testing. - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/installer/jobs/build-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - linux_musl_arm - - linux_musl_arm64 - - windows_x86 - - windows_arm64 - - linux_arm - jobParameters: - liveRuntimeBuildConfig: release - liveLibrariesBuildConfig: Release - runOnlyIfDependenciesSucceeded: true - condition: - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/installer/jobs/build-job.yml - buildConfig: Release - platforms: - - osx_arm64 - - osx_x64 - - linux_x64 - - linux_arm64 - - linux_musl_x64 - - windows_x64 - - freebsd_x64 - jobParameters: - liveRuntimeBuildConfig: release - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - runOnlyIfDependenciesSucceeded: true - condition: - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR Test builds using live libraries release build - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml - buildConfig: checked - platforms: - - CoreClrTestBuildHost # Either osx_x64 or linux_x64 - jobParameters: - testGroup: innerloop - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # CoreCLR Test executions using live libraries - # Only when CoreCLR is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml - buildConfig: checked - platforms: - - linux_arm - - windows_x86 - - windows_arm64 - helixQueueGroup: pr - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - jobParameters: - testGroup: innerloop - liveLibrariesBuildConfig: Release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml - buildConfig: checked - platforms: - - osx_x64 - - linux_x64 - - linux_arm64 - - windows_x64 - helixQueueGroup: pr - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - jobParameters: - testGroup: innerloop - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml - buildConfig: checked - platforms: - - osx_arm64 - helixQueueGroup: pr - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - jobParameters: - testGroup: innerloop - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr_AppleSilicon.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Mono Test builds with CoreCLR runtime tests using live libraries debug build - # Only when Mono is changed - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml - buildConfig: release - runtimeFlavor: mono - platforms: - - CoreClrTestBuildHost # Either osx_x64 or linux_x64 - jobParameters: - testGroup: innerloop - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml - buildConfig: release - runtimeFlavor: mono - platforms: - - windows_x64 - helixQueueGroup: pr - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - jobParameters: - testGroup: innerloop - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - liveRuntimeBuildConfig: release - runtimeVariant: minijit - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Build the whole product using Mono and run runtime tests - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - osx_x64 - - linux_arm64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_Minijit_RuntimeTests - runtimeVariant: minijit - buildArgs: -s mono+libs+clr.hosts+clr.iltools -c Release - timeoutInMinutes: 180 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - postBuildSteps: - - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_Release - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - - # - # Mono CoreCLR runtime Test executions using live libraries in interpreter mode - # Only when Mono is changed - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - osx_x64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_Interpreter_RuntimeTests - runtimeVariant: monointerpreter - buildArgs: -s mono+libs+clr.hosts+clr.iltools -c Release - timeoutInMinutes: 180 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - postBuildSteps: - - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_Release - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - # - # Mono CoreCLR runtime Test executions using live libraries and LLVM AOT - # Only when Mono is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - linux_x64 - # Disabled pending outcome of https://github.com/dotnet/runtime/issues/60234 investigation - #- linux_arm64 - variables: - - name: timeoutPerTestInMinutes - value: 60 - - name: timeoutPerTestCollectionInMinutes - value: 180 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_LLVMAot_RuntimeTests - runtimeVariant: llvmaot - buildArgs: -s mono+libs+clr.hosts+clr.iltools -c Release /p:MonoEnableLLVM=true /p:MonoAOTEnableLLVM=true /p:MonoBundleLLVMOptimizer=true - timeoutInMinutes: 180 - - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - postBuildSteps: - - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml - parameters: - creator: dotnet-bot - llvmAotStepContainer: linux_x64_llvmaot - testRunNamePrefixSuffix: Mono_Release - extraVariablesTemplates: - - template: /eng/pipelines/common/templates/runtimes/test-variables.yml - - # - # Libraries Release Test Execution against a release mono runtime. - # Only when libraries or mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - runtimeFlavor: mono - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - # - windows_x64 - - osx_x64 - - linux_arm64 - - linux_x64 - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - jobParameters: - isOfficialBuild: false - runtimeDisplayName: mono - testScope: innerloop - liveRuntimeBuildConfig: release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Libraries Release Test Execution against a release mono interpreter runtime. - # Only when libraries or mono changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - runtimeFlavor: mono - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - # - windows_x64 - #- osx_x64 - - linux_x64 - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - jobParameters: - isOfficialBuild: false - interpreter: true - runtimeDisplayName: mono_interpreter - testScope: innerloop - liveRuntimeBuildConfig: release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Libraries Release Test Execution against a release coreclr runtime - # Only when the PR contains a libraries change - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - buildConfig: Release - platforms: - - windows_x86 - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - jobParameters: - isOfficialBuild: false - testScope: innerloop - liveRuntimeBuildConfig: release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Libraries Debug Test Execution against a release coreclr runtime - # Only when the PR contains a libraries change - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - windows_x64 - - osx_x64 - - linux_x64 - - linux_musl_x64 - helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - jobParameters: - isOfficialBuild: false - testScope: innerloop - liveRuntimeBuildConfig: release - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # The next three jobs run checked coreclr + libraries tests. - # The matrix looks like the following, where the right columns specify which configurations - # the libraries tests are built in. - # ________________________________________ - # | Platform | PR | Rolling | - # | ---------------- | ------- | ------- | - # | linux-arm64 | Debug | Release | - # | windows-x86 | Debug | Release | - # | linux-musl-x64 | Debug | Release | - # | OSX-x64 | Debug | Release | - # | linux-musl-arm | Release | Release | - # | linux-musl-arm64 | Release | Release | - # | linux-x64 | Release | Release | - # | windows-x64 | Release | Release | - - # - # Debug (PR) / Release (rolling) Libraries Test Execution against a checked runtime - # Only when the PR contains a coreclr change - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - linux_arm64 - - windows_x86 - - linux_musl_x64 - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - helixQueueGroup: libraries - jobParameters: - testScope: innerloop - liveRuntimeBuildConfig: checked - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Release Libraries Test Execution against a checked runtime - # Only if CoreCLR or Libraries is changed - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - buildConfig: Release - platforms: - - linux_musl_arm - - linux_musl_arm64 - - linux_x64 - - windows_x64 - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - helixQueueGroup: libraries - jobParameters: - testScope: innerloop - liveRuntimeBuildConfig: checked - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/libraries/run-test-job.yml - buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - platforms: - - osx_x64 - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - helixQueueGroup: libraries - jobParameters: - testScope: innerloop - liveRuntimeBuildConfig: checked - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(variables['isRollingBuild'], true)) - - # - # Sourcebuild legs - # We have 3 important legs for source-build: - # - Centos.8 (ensures that known non-portable RID is working) - # - Linux-x64 portable (used for dependency flow and downstream PR verification) - # - Banana.24 - Non-existent RID to ensure we don't break RIDs we don't know about. - # - # Running all of these everywhere is wasteful. Run Banana.24 and CentOS.8 in rolling CI, - # Run Linux-x64 in PR. - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - helixQueueGroup: pr - platforms: - - SourceBuild_centos8_x64 - jobParameters: - nameSuffix: centos8SourceBuild - timeoutInMinutes: 95 - condition: eq(variables['isRollingBuild'], true) - - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - buildConfig: Release - helixQueueGroup: pr - platforms: - - SourceBuild_banana24_x64 - jobParameters: - nameSuffix: banana24SourceBuild - timeoutInMinutes: 95 - condition: eq(variables['isRollingBuild'], true) diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt index 5ccb34b25e18ac..11d2df2ad2eb3b 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt @@ -1,48 +1 @@ -Wasm.Build.NativeRebuild.Tests.FlagsChangeRebuildTests -Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest -Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests -Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest -Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest -Wasm.Build.Templates.Tests.InterpPgoTests -Wasm.Build.Templates.Tests.NativeBuildTests -Wasm.Build.Tests.Blazor.AppsettingsTests -Wasm.Build.Tests.Blazor.BuildPublishTests -Wasm.Build.Tests.Blazor.SimpleRunTests -Wasm.Build.Tests.Blazor.CleanTests -Wasm.Build.Tests.Blazor.MiscTests -Wasm.Build.Tests.Blazor.MiscTests2 -Wasm.Build.Tests.Blazor.MiscTests3 -Wasm.Build.Tests.Blazor.NativeTests -Wasm.Build.Tests.Blazor.NoopNativeRebuildTest -Wasm.Build.Tests.Blazor.WorkloadRequiredTests -Wasm.Build.Tests.Blazor.IcuTests -Wasm.Build.Tests.Blazor.IcuShardingTests -Wasm.Build.Tests.BuildPublishTests -Wasm.Build.Tests.ConfigSrcTests -Wasm.Build.Tests.HybridGlobalizationTests -Wasm.Build.Tests.IcuShardingTests -Wasm.Build.Tests.IcuShardingTests2 -Wasm.Build.Tests.IcuTests -Wasm.Build.Tests.InvariantGlobalizationTests -Wasm.Build.Tests.InvariantTimezoneTests -Wasm.Build.Tests.MainWithArgsTests -Wasm.Build.Tests.NativeBuildTests -Wasm.Build.Tests.NativeLibraryTests -Wasm.Build.Tests.NonWasmTemplateBuildTests -Wasm.Build.Tests.PInvokeTableGeneratorTests -Wasm.Build.Tests.RebuildTests -Wasm.Build.Tests.SatelliteAssembliesTests -Wasm.Build.Tests.TestAppScenarios.AppSettingsTests -Wasm.Build.Tests.TestAppScenarios.LazyLoadingTests -Wasm.Build.Tests.TestAppScenarios.LibraryInitializerTests -Wasm.Build.Tests.TestAppScenarios.SatelliteLoadingTests -Wasm.Build.Tests.TestAppScenarios.DownloadResourceProgressTests Wasm.Build.Tests.TestAppScenarios.SignalRClientTests -Wasm.Build.Tests.WasmBuildAppTest -Wasm.Build.Tests.WasmNativeDefaultsTests -Wasm.Build.Tests.WasmRunOutOfAppBundleTests -Wasm.Build.Tests.WasmSIMDTests -Wasm.Build.Tests.WasmTemplateTests -Wasm.Build.Tests.WorkloadTests -Wasm.Build.Tests.MT.Blazor.SimpleMultiThreadedTests -Wasm.Build.Tests.TestAppScenarios.DebugLevelTests diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index 635ef2d738eed8..b0c3a3fba128f4 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -78,19 +78,23 @@ private async Task SignalRPassMessages() => await Task.Run(async () => { + Helper.TestOutputWriteLine($"SignalRPassMessages on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); await _hubConnection.SendAsync( "SendMessage", message, Environment.CurrentManagedThreadId); Helper.TestOutputWriteLine($"SignalRPassMessages was sent by CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); }); private async Task SendExitSignal() { + Helper.TestOutputWriteLine($"SendExitSignal on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); await DisposeHubConnection(); // exit the client await JSRuntime.InvokeVoidAsync("eval", "import('./dotnet.js').then(module => { module.dotnet; module.exit(0); });"); + Helper.TestOutputWriteLine($"SendExitSignal done on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); } private async Task DisposeHubConnection() { + Helper.TestOutputWriteLine($"DisposeHubConnection on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); if (_hubConnection != null) { _hubConnection.Remove("ReceiveMessage"); From 574f540f1a14ae0ad1f42b05c5980d1d9056ed43 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 7 Mar 2024 16:18:02 +0100 Subject: [PATCH 3/6] assertAfterExit: true --- src/mono/browser/runtime/loader/config.ts | 4 ++-- src/mono/browser/runtime/loader/globals.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mono/browser/runtime/loader/config.ts b/src/mono/browser/runtime/loader/config.ts index e9ae9e1dd3e69d..bd096c92a4c7f3 100644 --- a/src/mono/browser/runtime/loader/config.ts +++ b/src/mono/browser/runtime/loader/config.ts @@ -6,7 +6,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import { MainThreadingMode, type DotnetModuleInternal, type MonoConfigInternal, JSThreadBlockingMode, JSThreadInteropMode } from "../types/internal"; import type { DotnetModuleConfig, MonoConfig, ResourceGroups, ResourceList } from "../types"; -import { ENVIRONMENT_IS_WEB, exportedRuntimeAPI, loaderHelpers, runtimeHelpers } from "./globals"; +import { exportedRuntimeAPI, loaderHelpers, runtimeHelpers } from "./globals"; import { mono_log_error, mono_log_debug } from "./logging"; import { importLibraryInitializers, invokeLibraryInitializers } from "./libraryInitializers"; import { mono_exit } from "./exit"; @@ -178,7 +178,7 @@ export function normalizeConfig() { } } - loaderHelpers.assertAfterExit = config.assertAfterExit = config.assertAfterExit || !ENVIRONMENT_IS_WEB; + loaderHelpers.assertAfterExit = true; if (config.debugLevel === undefined && BuildConfiguration === "Debug") { config.debugLevel = -1; diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 7e9708845e65b0..fdcea854073b95 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -86,7 +86,7 @@ export function setLoaderGlobals( maxParallelDownloads: 16, enableDownloadRetry: true, - assertAfterExit: !ENVIRONMENT_IS_WEB, + assertAfterExit: true, _loaded_files: [], loadedFiles: [], From cec33a135760f3683e207c6a7a3abdc4c8693d4c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 7 Mar 2024 17:08:41 +0100 Subject: [PATCH 4/6] timeout --- src/libraries/sendtohelix-wasm.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/sendtohelix-wasm.targets b/src/libraries/sendtohelix-wasm.targets index d9c2e3aead0845..dfd5849d371b3c 100644 --- a/src/libraries/sendtohelix-wasm.targets +++ b/src/libraries/sendtohelix-wasm.targets @@ -2,7 +2,7 @@ - <_workItemTimeout Condition="'$(Scenario)' == 'BuildWasmApps' and '$(_workItemTimeout)' == ''">01:30:00 + <_workItemTimeout Condition="'$(Scenario)' == 'BuildWasmApps' and '$(_workItemTimeout)' == ''">00:20:00 <_workItemTimeout Condition="'$(NeedsToBuildWasmAppsOnHelix)' == 'true'">01:00:00 $([MSBuild]::NormalizeDirectory($(BrowserProjectRoot), 'build')) From 68d59fa7a41b56ff864bf9cd220478950a646775 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 7 Mar 2024 17:28:53 +0100 Subject: [PATCH 5/6] more --- src/mono/browser/runtime/cancelable-promise.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/cancelable-promise.ts b/src/mono/browser/runtime/cancelable-promise.ts index 52d34c7d51151d..e24bd57c4eef82 100644 --- a/src/mono/browser/runtime/cancelable-promise.ts +++ b/src/mono/browser/runtime/cancelable-promise.ts @@ -151,7 +151,7 @@ export class PromiseHolder extends ManagedObject { settleUnsettledPromise(); } - mono_log_warn("complete_task " + this.gc_handle); + mono_log_warn("complete_task " + this.gc_handle + " \n" + new Error().stack); // we can unregister the GC handle just on JS side teardown_managed_proxy(this, this.gc_handle, /*skipManaged: */ true); // order of operations with teardown_managed_proxy matters From dbd1da1ab1049a7eb9971ff6e199abb41a96ae5f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 8 Mar 2024 12:36:32 +0100 Subject: [PATCH 6/6] wip --- src/mono/browser/runtime/cancelable-promise.ts | 10 ++++++++++ src/mono/browser/runtime/marshal-to-cs.ts | 2 ++ src/mono/browser/runtime/memory.ts | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/cancelable-promise.ts b/src/mono/browser/runtime/cancelable-promise.ts index e24bd57c4eef82..73b4ad759e786f 100644 --- a/src/mono/browser/runtime/cancelable-promise.ts +++ b/src/mono/browser/runtime/cancelable-promise.ts @@ -63,17 +63,22 @@ export class PromiseHolder extends ManagedObject { // returns false if the promise is being canceled by another thread in managed code setIsResolving(): boolean { + mono_log_warn("setIsResolving A " + this.gc_handle + " at " + this.promiseHolderPtr); if (!WasmEnableThreads || this.promiseHolderPtr === 0) { + mono_log_warn("setIsResolving A " + this.gc_handle); return true; } forceThreadMemoryViewRefresh(); if (compareExchangeI32(this.promiseHolderPtr + PromiseHolderState.IsResolving, 1, 0) === 0) { + mono_log_warn("setIsResolving B " + this.gc_handle); return true; } + mono_log_warn("setIsResolving C " + this.gc_handle); return false; } resolve(data: any) { + mono_log_warn("resolve " + this.gc_handle + " \n" + new Error().stack); mono_assert(!this.isResolved, "resolve could be called only once"); if (WasmEnableThreads && !this.setIsResolving()) { // we know that cancelation is in flight @@ -82,6 +87,7 @@ export class PromiseHolder extends ManagedObject { // we store the original data and use it later this.data = data; this.isPostponed = true; + mono_log_warn("resolve isPostponed" + this.gc_handle); // but after the promise is resolved, nothing holds the weak reference to the PromiseHolder anymore // we know that cancelation is in flight, so we upgrade the weak reference to strong for the meantime @@ -93,6 +99,7 @@ export class PromiseHolder extends ManagedObject { } reject(reason: any) { + mono_log_warn("reject " + this.gc_handle + " \n" + new Error().stack); mono_assert(!this.isResolved, "reject could be called only once"); const isCancelation = reason && reason[promise_holder_symbol] === this; if (WasmEnableThreads && !isCancelation && !this.setIsResolving()) { @@ -102,6 +109,7 @@ export class PromiseHolder extends ManagedObject { // we store the original reason and use it later this.reason = reason; this.isPostponed = true; + mono_log_warn("reject isPostponed" + this.gc_handle); // but after the promise is resolved, nothing holds the weak reference to the PromiseHolder anymore // we know that cancelation is in flight, so we upgrade the weak reference to strong for the meantime @@ -113,6 +121,8 @@ export class PromiseHolder extends ManagedObject { } cancel() { + mono_log_warn("cancel " + this.gc_handle + " \n" + new Error().stack); + mono_assert(!this.isResolved, "cancel could be called only once"); if (this.isPostponed) { diff --git a/src/mono/browser/runtime/marshal-to-cs.ts b/src/mono/browser/runtime/marshal-to-cs.ts index 9e82ab8a2711e0..2c009450f8bbf6 100644 --- a/src/mono/browser/runtime/marshal-to-cs.ts +++ b/src/mono/browser/runtime/marshal-to-cs.ts @@ -24,6 +24,7 @@ import { JSMarshalerArgument, JSMarshalerArguments, JSMarshalerType, MarshalerTo import { TypedArray } from "./types/emscripten"; import { addUnsettledPromise } from "./pthreads"; import { gc_locked } from "./gc-lock"; +import { mono_log_warn } from "./logging"; export const jsinteropDoc = "For more information see https://aka.ms/dotnet-wasm-jsinterop"; @@ -332,6 +333,7 @@ function _marshal_task_to_cs(arg: JSMarshalerArgument, value: Promise, _?: set_arg_type(arg, MarshalerType.Task); } + mono_log_warn("_marshal_task_to_cs handleIsPreallocated:" + handleIsPreallocated + " " + gc_handle + " at " + promiseHolderPtr); const holder = new PromiseHolder(value, gc_handle, promiseHolderPtr, res_converter); setup_managed_proxy(holder, gc_handle); diff --git a/src/mono/browser/runtime/memory.ts b/src/mono/browser/runtime/memory.ts index 1e8db0fd0d4e85..585c6e377a1c1e 100644 --- a/src/mono/browser/runtime/memory.ts +++ b/src/mono/browser/runtime/memory.ts @@ -331,7 +331,7 @@ export function compareExchangeI32(offset: MemOffset, value: number, expected: n } return actual; } - return globalThis.Atomics.compareExchange(localHeapViewI32(), offset >>> 2, value, expected); + return globalThis.Atomics.compareExchange(localHeapViewI32(), offset >>> 2, expected, value); } export function storeI32(offset: MemOffset, value: number): void {