diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d6009aca5b521..bd0d4baaf2830 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "1.0.0-prerelease.20403.2", + "version": "1.0.0-prerelease.20474.1", "commands": [ "xharness" ] diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 0db27321298de..3e0f2ca420b81 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -300,6 +300,49 @@ jobs: eq(dependencies.checkout.outputs['SetPathVars_installer.containsChange'], true), eq(variables['isFullMatrix'], true)) +# +# Build the whole product using Mono and run libraries tests, multi-scenario +# +- 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: + - Browser_wasm + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.checkout.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.checkout.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_Mono + buildArgs: -s mono+libs+installer+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true + timeoutInMinutes: 120 + condition: >- + or( + eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.checkout.outputs['SetPathVars_installer.containsChange'], true), + eq(variables['isFullMatrix'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + scenarios: + - normal + - wasmtestonbrowser + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) + + # # Build the whole product using Mono and run libraries tests # @@ -311,7 +354,6 @@ jobs: runtimeFlavor: mono platforms: - iOS_x64 - - Browser_wasm variables: # map dependencies variables to local variables - name: librariesContainsChange diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh index c9272caf8f188..e2e3996cab58c 100644 --- a/eng/testing/WasmRunnerTemplate.sh +++ b/eng/testing/WasmRunnerTemplate.sh @@ -14,6 +14,10 @@ else HARNESS_RUNNER="dotnet xharness" fi +if [ -z "$XHARNESS_COMMAND" ]; then + XHARNESS_COMMAND="test" +fi + # RunCommands defined in tests.mobile.targets [[RunCommands]] diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 0a3f5f46c4e18..ff3fdd2c49046 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -14,7 +14,7 @@ - $HARNESS_RUNNER wasm test --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll + $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index 7c9ce51dcc39c..94c7eb3033b09 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -2725,7 +2725,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, rootUrl) => } #endregion - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux), nameof(PlatformDetection.IsNotBrowserDomSupported))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")] public async Task GetAsync_InvalidUrl_ExpectedExceptionThrown() { string invalidUri = $"http://{Configuration.Sockets.InvalidHost}"; diff --git a/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs b/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs index 214ebd36424a0..845bd19558717 100644 --- a/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs +++ b/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs @@ -48,7 +48,8 @@ public LoopbackServer(Options options = null) } catch { - _listenSocket.Dispose(); + _listenSocket?.Dispose(); + throw; } } diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 85ed4fa8d7ef9..3cc55749aef2d 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -48,6 +48,9 @@ public static partial class PlatformDetection public static bool IsThreadingSupported => !IsBrowser; public static bool IsBinaryFormatterSupported => !IsBrowser; + public static bool IsBrowserDomSupported => GetIsBrowserDomSupported(); + public static bool IsNotBrowserDomSupported => !IsBrowserDomSupported; + // Please make sure that you have the libgdiplus dependency installed. // For details, see https://docs.microsoft.com/dotnet/core/install/dependencies?pivots=os-macos&tabs=netcore31#libgdiplus public static bool IsDrawingSupported @@ -367,5 +370,14 @@ private static bool GetIsRunningOnMonoInterpreter() var val = Environment.GetEnvironmentVariable("MONO_ENV_OPTIONS"); return (val != null && val.Contains("--interpreter")); } + + private static bool GetIsBrowserDomSupported() + { + if (!IsBrowser) + return false; + + var val = Environment.GetEnvironmentVariable("IsBrowserDomSupported"); + return (val != null && val == "true"); + } } } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index e88066881ba3e..a3313a80abeef 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -126,10 +126,12 @@ public sealed class SocketsHttpHandler_HttpClient_SelectedSites_Test : HttpClien public SocketsHttpHandler_HttpClient_SelectedSites_Test(ITestOutputHelper output) : base(output) { } } +#if !TARGETS_BROWSER public sealed class SocketsHttpHandler_HttpClientEKUTest : HttpClientEKUTest { public SocketsHttpHandler_HttpClientEKUTest(ITestOutputHelper output) : base(output) { } } +#endif public sealed class SocketsHttpHandler_HttpClientHandler_Decompression_Tests : HttpClientHandler_Decompression_Test { @@ -941,6 +943,7 @@ public sealed class SocketsHttpHandler_SchSendAuxRecordHttpTest : SchSendAuxReco public SocketsHttpHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { } } + [SkipOnMono("Tests hang with chrome. To be investigated", TestPlatforms.Browser)] public sealed class SocketsHttpHandler_HttpClientHandlerTest : HttpClientHandlerTest { public SocketsHttpHandler_HttpClientHandlerTest(ITestOutputHelper output) : base(output) { } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index 95d2fdf281ecf..3de49f7437257 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -2,6 +2,7 @@ ../../src/Resources/Strings.resx $(DefineConstants);TargetsWindows + $(DefineConstants);TARGETS_BROWSER $(DefineConstants);SYSNETHTTP_NO_OPENSSL;HTTP3 true true @@ -193,7 +194,7 @@ - diff --git a/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs b/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs index 722eab2b2240f..482014481e8fb 100644 --- a/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs @@ -68,7 +68,7 @@ public static void ReadAfterInitializationWithTextReaderOnAsyncReaderDoesNotThro } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static void ReadAsyncAfterInitializationWithUriThrows() { using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true })) @@ -77,7 +77,7 @@ public static void ReadAsyncAfterInitializationWithUriThrows() } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static void ReadAfterInitializationWithUriOnAsyncReaderTrows() { using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true })) diff --git a/src/libraries/sendtohelix.proj b/src/libraries/sendtohelix.proj index dad3dc9f584d8..a2804bcf3cdf4 100644 --- a/src/libraries/sendtohelix.proj +++ b/src/libraries/sendtohelix.proj @@ -116,7 +116,7 @@ - + diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index b0d7ac96df327..bd8e91878d682 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -95,6 +95,16 @@ + + + + + + + + + + @@ -104,8 +114,8 @@ (which is when this project is invoked to call the "CreateTestEnvFile" target). --> - SetStressModes_$(Scenario).cmd - SetStressModes_$(Scenario).sh + SetStressModes_$(Scenario).cmd + SetStressModes_$(Scenario).sh @@ -176,9 +186,19 @@ + + + + 768968 + https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$(ChromiumRevision)/chrome-linux.zip + https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$(ChromiumRevision)/chromedriver_linux64.zip + + + Condition="'$(IncludeHelixCorrelationPayload)' == 'true' and '$(TargetOS)' != 'Browser'" /> + + <_WorkItem Include="$(WorkItemArchiveWildCard)" Exclude="$(HelixCorrelationPayload)" /> diff --git a/src/mono/wasm/runtime-test.js b/src/mono/wasm/runtime-test.js index b3fbf5dc3fbca..7cf27afd16a21 100644 --- a/src/mono/wasm/runtime-test.js +++ b/src/mono/wasm/runtime-test.js @@ -5,9 +5,34 @@ //glue code to deal with the differences between chrome, ch, d8, jsc and sm. var is_browser = typeof window != "undefined"; +var consoleWebSocket; +var print; if (is_browser) { // We expect to be run by tests/runtime/run.js which passes in the arguments using http parameters + window.real_print = console.log; + print = function(_msg) { window.real_print(_msg); }; + console.log = print; + console.debug = print; + console.error = print; + console.trace = print; + console.warn = print; + console.info = print; + + const consoleUrl = `${window.location.origin}/console`.replace('http://', 'ws://'); + + consoleWebSocket = new WebSocket(consoleUrl); + consoleWebSocket.onopen = function(event) { + consoleWebSocket.send("browser: Console websocket connected."); + + window.real_print = function(msg) { + consoleWebSocket.send(msg); + }; + }; + consoleWebSocket.onerror = function(event) { + console.log(`websocket error: ${event}`); + }; + var url = new URL (decodeURI (window.location)); arguments = []; for (var v of url.searchParams) { @@ -18,9 +43,6 @@ if (is_browser) { } } -if (is_browser || typeof print === "undefined") - print = console.log; - // JavaScript core does not have a console defined if (typeof console === "undefined") { var Console = function () { @@ -151,6 +173,9 @@ while (args !== undefined && args.length > 0) { } testArguments = args; +// cheap way to let the testing infrastructure know we're running in a browser context (or not) +setenv["IsBrowserDomSupported"] = is_browser.toString().toLowerCase(); + function writeContentToFile(content, path) { var stream = FS.open(path, 'w+');