From 8f0fc50bfe71e3ba0a617c59cef61fe11f2b3c5b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 21 Apr 2023 16:43:59 +0200 Subject: [PATCH 1/2] testing --- .../tests/System.Net.WebSockets.Client.Tests.csproj | 5 ++--- src/mono/wasm/runtime/logging.ts | 11 +++++++++-- src/mono/wasm/test-main.js | 7 ++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj index e15f88b3c36900..6bf74ea597ce70 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj +++ b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj @@ -7,9 +7,6 @@ $(DefineConstants);NETSTANDARD false - - - $(WasmXHarnessMonoArgs) --no-memory-snapshot @@ -18,6 +15,8 @@ $(TestArchiveRoot)browserornodejs/ $(TestArchiveTestsRoot)$(OSPlatformConfig)/ $(DefineConstants);TARGET_BROWSER + --setenv=XHARNESS_LOG_TEST_START=true --no-memory-snapshot + 00:45:00 diff --git a/src/mono/wasm/runtime/logging.ts b/src/mono/wasm/runtime/logging.ts index a4420b01f57f5f..333fed32f235cf 100644 --- a/src/mono/wasm/runtime/logging.ts +++ b/src/mono/wasm/runtime/logging.ts @@ -131,8 +131,15 @@ export function setup_proxy_console(id: string, console: Console, origin: string } } - if (typeof payload === "string" && id !== "main") - payload = `[${id}] ${payload}`; + const now = new Date().toISOString(); + if (typeof payload === "string") + if (payload[0] == "[") + if (id !== "main") + payload = `[${id}][${now}] ${payload}`; + else + payload = `[${now}] ${payload}`; + else if (id !== "main") + payload = `[${id}] ${payload}`; if (asJson) { func(JSON.stringify({ diff --git a/src/mono/wasm/test-main.js b/src/mono/wasm/test-main.js index 3d835c0bb61407..475163ecfe5c0a 100644 --- a/src/mono/wasm/test-main.js +++ b/src/mono/wasm/test-main.js @@ -25,12 +25,12 @@ if (is_node && process.versions.node.split(".")[0] < 14) { if (is_node) { // the emscripten 3.1.34 stopped handling these when MODULARIZE is enabled - process.on('uncaughtException', function(ex) { + process.on('uncaughtException', function (ex) { // ignore UnhandledPromiseRejection exceptions with exit status if (ex !== 'unwind' && (ex.name !== "UnhandledPromiseRejection" || !ex.message.includes('"#"'))) { - throw ex; + throw ex; } - }); + }); } if (!is_node && !is_browser && typeof globalThis.crypto === 'undefined') { @@ -387,6 +387,7 @@ async function run() { const main_assembly_name = runArgs.applicationArguments[1]; const app_args = runArgs.applicationArguments.slice(2); const result = await App.runtime.runMain(main_assembly_name, app_args); + console.log(`test-main.js exiting ${app_args.length > 1 ? main_assembly_name + " " + app_args[0] : main_assembly_name} with result ${result}`); mono_exit(result); } catch (error) { if (error.name != "ExitStatus") { From d901b34b7faaf1e1c0598d30afa91476641551e5 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Mon, 24 Apr 2023 11:22:53 +0200 Subject: [PATCH 2/2] Update src/mono/wasm/runtime/logging.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marek FiĊĦera --- src/mono/wasm/runtime/logging.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mono/wasm/runtime/logging.ts b/src/mono/wasm/runtime/logging.ts index 333fed32f235cf..9e3bef14fa4792 100644 --- a/src/mono/wasm/runtime/logging.ts +++ b/src/mono/wasm/runtime/logging.ts @@ -131,15 +131,18 @@ export function setup_proxy_console(id: string, console: Console, origin: string } } - const now = new Date().toISOString(); - if (typeof payload === "string") - if (payload[0] == "[") - if (id !== "main") + if (typeof payload === "string") { + if (payload[0] == "[") { + const now = new Date().toISOString(); + if (id !== "main") { payload = `[${id}][${now}] ${payload}`; - else + } else { payload = `[${now}] ${payload}`; - else if (id !== "main") + } + } else if (id !== "main") { payload = `[${id}] ${payload}`; + } + } if (asJson) { func(JSON.stringify({