diff --git a/eng/pipelines/mono/templates/xplat-pipeline-job.yml b/eng/pipelines/mono/templates/xplat-pipeline-job.yml index 31b61c20f93d11..ec33ae87df4005 100644 --- a/eng/pipelines/mono/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/mono/templates/xplat-pipeline-job.yml @@ -85,6 +85,9 @@ jobs: - name: nativeTestArtifactRootFolderPath value: '$(binTestsPath)/obj/$(osGroup).$(archType).$(buildConfigUpper)' + - name: priorityArg + value: '' + - name: liveRuntimeBuildConfigUpper ${{ if eq(parameters.liveRuntimeBuildConfig, 'release') }}: value: 'Release' diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index f99e5a399f7b48..abe923bd706721 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -175,6 +175,44 @@ jobs: creator: dotnet-bot testRunNamePrefixSuffix: Mono_$(_BuildConfig) +# +# Build the whole product using Mono for Windows 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: +# - windows_x64 +# variables: +# - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: +# - name: _HelixSource +# value: pr/dotnet/runtime/$(Build.SourceBranch) +# - ${{ if and(eq(variables['System.TeamProject'], ='public'), ne(variables['Build.Reason'], 'PullRequest')) }}: +# - name: _HelixSource +# value: ci/dotnet/runtime/$(Build.SourceBranch) +# - name: timeoutPerTestInMinutes +# value: 60 +# - name: timeoutPerTestCollectionInMinutes +# value: 180 +# jobParameters: +# testGroup: innerloop +# nameSuffix: AllSubsets_Mono_RuntimeTests +# buildArgs: -s mono+libs -c $(_BuildConfig) +# timeoutInMinutes: 240 +# condition: >- +# or( +# eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), +# eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), +# eq(variables['isFullMatrix'], true)) +# # extra steps, run tests +# extraStepsTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml +# extraStepsParameters: +# creator: dotnet-bot +# testRunNamePrefixSuffix: Mono_WinTest_$(_BuildConfig) + # Run disabled installer tests on Linux x64 - template: /eng/pipelines/common/platform-matrix.yml parameters: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 14b5cf0bdcbee6..c743aa17357b77 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -834,6 +834,7 @@ jobs: platforms: - OSX_x64 - Linux_arm64 + - windows_x64 helixQueueGroup: pr helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml jobParameters: diff --git a/src/libraries/System.Drawing.Common/tests/IconTests.cs b/src/libraries/System.Drawing.Common/tests/IconTests.cs index bb501fc108f074..2ad23d5f18d5fd 100644 --- a/src/libraries/System.Drawing.Common/tests/IconTests.cs +++ b/src/libraries/System.Drawing.Common/tests/IconTests.cs @@ -500,7 +500,7 @@ public void Save_NullOutputStreamIconData_ThrowsNullReferenceException() [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] [ConditionalFact(Helpers.IsDrawingSupported)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void Save_NullOutputStreamNoIconData_ThrowsArgumentNullException() { using (var source = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -526,6 +526,7 @@ public void Save_ClosedOutputStreamIconData_ThrowsException() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [ConditionalFact(Helpers.IsDrawingSupported)] public void Save_ClosedOutputStreamNoIconData_DoesNothing() { @@ -688,7 +689,7 @@ private static Icon GetPngIcon() } [ConditionalFact(Helpers.IsDrawingSupported)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void FromHandle_IconHandleOneTime_Success() { using (var icon1 = new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -701,7 +702,7 @@ public void FromHandle_IconHandleOneTime_Success() } [ConditionalFact(Helpers.IsDrawingSupported)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void FromHandle_IconHandleMultipleTime_Success() { using (var icon1 = new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -722,7 +723,7 @@ public void FromHandle_IconHandleMultipleTime_Success() } [ConditionalFact(Helpers.IsDrawingSupported)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void FromHandle_BitmapHandleOneTime_Success() { IntPtr handle; @@ -739,7 +740,7 @@ public void FromHandle_BitmapHandleOneTime_Success() } [ConditionalFact(Helpers.IsDrawingSupported)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/47759", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void FromHandle_BitmapHandleMultipleTime_Success() { IntPtr handle; diff --git a/src/mono/mono/metadata/native-library.c b/src/mono/mono/metadata/native-library.c index 2753582d00ae6d..c69304ce26ff5f 100644 --- a/src/mono/mono/metadata/native-library.c +++ b/src/mono/mono/metadata/native-library.c @@ -1578,16 +1578,19 @@ ves_icall_System_Runtime_InteropServices_NativeLibrary_FreeLib (gpointer lib, Mo native_library_lock (); module = netcore_handle_lookup (lib); - if (!module) - goto leave; - - ref_count = mono_refcount_dec (module); - if (ref_count > 0) - goto leave; - - g_hash_table_remove (native_library_module_map, module->handle); - g_hash_table_add (native_library_module_blocklist, module); - mono_dl_close (module); + if (module) { + ref_count = mono_refcount_dec (module); + if (ref_count > 0) + goto leave; + + g_hash_table_remove (native_library_module_map, module->handle); + g_hash_table_add (native_library_module_blocklist, module); + mono_dl_close (module); + } else { + MonoDl raw_module = { 0 }; + raw_module.handle = lib; + mono_dl_close (&raw_module); + } leave: native_library_unlock (); @@ -1610,16 +1613,18 @@ ves_icall_System_Runtime_InteropServices_NativeLibrary_GetSymbol (gpointer lib, native_library_lock (); module = netcore_handle_lookup (lib); - if (!module) - mono_error_set_generic_error (error, "System", "DllNotFoundException", "%p: %s", lib, symbol_name); - goto_if_nok (error, leave); - - mono_dl_symbol (module, symbol_name, &symbol); - if (!symbol) - mono_error_set_generic_error (error, "System", "EntryPointNotFoundException", "%s: %s", module->full_name, symbol_name); - goto_if_nok (error, leave); + if (module) { + mono_dl_symbol (module, symbol_name, &symbol); + if (!symbol) + mono_error_set_generic_error (error, "System", "EntryPointNotFoundException", "%s: %s", module->full_name, symbol_name); + } else { + MonoDl raw_module = { 0 }; + raw_module.handle = lib; + mono_dl_symbol (&raw_module, symbol_name, &symbol); + if (!symbol) + mono_error_set_generic_error (error, "System", "EntryPointNotFoundException", "%p: %s", lib, symbol_name); + } -leave: native_library_unlock (); leave_nolock: diff --git a/src/tests/build.cmd b/src/tests/build.cmd index 985568d0712adb..55d3292468469b 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -72,6 +72,7 @@ set __Priority=0 set __PriorityArg= set __BuildNeedTargetArg= +set __Mono=0 :Arg_Loop if "%1" == "" goto ArgsDone @@ -474,13 +475,14 @@ set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%" set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%" set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! -if %%__Mono%%==1 ( +if %__Mono%==1 ( set RuntimeFlavor="mono" ) else ( set RuntimeFlavor="coreclr" ) REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well. +echo "%__RepoRootDir%\dotnet.cmd" msbuild %__RepoRootDir%\src\tests\run.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__SkipFXRestoreArg% %__UnprocessedBuildArgs% /p:RuntimeFlavor=%RuntimeFlavor% call "%__RepoRootDir%\dotnet.cmd" msbuild %__RepoRootDir%\src\tests\run.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__SkipFXRestoreArg% %__UnprocessedBuildArgs% /p:RuntimeFlavor=%RuntimeFlavor% if errorlevel 1 ( echo %__ErrMsgPrefix%%__MsgPrefix%Error: XUnit wrapper build failed. Refer to the build log files for details: