Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.21561.1",
"version": "1.0.0-prerelease.21572.4",
"commands": [
"xharness"
]
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@
<Uri>https://github.com/dotnet/linker</Uri>
<Sha>f2dd65f51f6096f25e00e0d1e4c6af0e85d41865</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21561.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21572.4">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>42da0d206c22393c081abc4b6a48a181e17bb372</Sha>
<Sha>7aa4d338b58a2b21974933802bd731a64c36c1d8</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="1.0.0-prerelease.21561.1">
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="1.0.0-prerelease.21572.4">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>42da0d206c22393c081abc4b6a48a181e17bb372</Sha>
<Sha>7aa4d338b58a2b21974933802bd731a64c36c1d8</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.PackageTesting" Version="7.0.0-beta.21559.3">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@
<!-- Testing -->
<MicrosoftNETCoreCoreDisToolsVersion>1.0.1-prerelease-00006</MicrosoftNETCoreCoreDisToolsVersion>
<MicrosoftNETTestSdkVersion>16.9.0-preview-20201201-01</MicrosoftNETTestSdkVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>1.0.0-prerelease.21561.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>1.0.0-prerelease.21561.1</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>1.0.0-prerelease.21572.4</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>1.0.0-prerelease.21572.4</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>1.0.2-alpha.0.21558.2</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
<XUnitVersion>2.4.2-pre.9</XUnitVersion>
<XUnitRunnerVisualStudioVersion>2.4.2</XUnitRunnerVisualStudioVersion>
Expand Down
40 changes: 24 additions & 16 deletions src/mono/wasm/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const originalConsole = {
};

let isXUnitDoneCheck = false;
let isXmlDoneCheck = false;

function proxyMethod(prefix, func, asJson) {
return function () {
Expand All @@ -42,7 +43,12 @@ function proxyMethod(prefix, func, asJson) {
isXUnitDoneCheck = true;
}

if (asJson) {
if (payload.startsWith("STARTRESULTXML")) {
originalConsole.log('Sending RESULTXML')
isXmlDoneCheck = true;
func(payload);
}
else if (asJson) {
func(JSON.stringify({
method: prefix,
payload: payload,
Expand All @@ -66,10 +72,12 @@ function proxyJson(func) {
console[m] = proxyMethod(`console.${m}`, func, true);
}

let consoleWebSocket;

if (is_browser) {
const consoleUrl = `${window.location.origin}/console`.replace('http://', 'ws://');

let consoleWebSocket = new WebSocket(consoleUrl);
consoleWebSocket = new WebSocket(consoleUrl);
// redirect output so that when emscripten starts it's already redirected
proxyJson(function (msg) {
if (consoleWebSocket.readyState === WebSocket.OPEN) {
Expand Down Expand Up @@ -238,7 +246,7 @@ function set_exit_code(exit_code, reason) {
}
if (is_browser) {
const stack = (new Error()).stack.replace(/\n/g, "").replace(/[ ]*at/g, " at").replace(/https?:\/\/[0-9.:]*/g, "").replace("Error", "");
const messsage = `Exit called with ${exit_code} when isXUnitDoneCheck=${isXUnitDoneCheck} ${stack}.`;
const messsage = `Exit called with ${exit_code} when isXUnitDoneCheck=${isXUnitDoneCheck} isXmlDoneCheck=${isXmlDoneCheck} WS.bufferedAmount=${consoleWebSocket.bufferedAmount} ${stack}.`;

// Notify the selenium script
Module.exit_code = exit_code;
Expand All @@ -249,20 +257,20 @@ function set_exit_code(exit_code, reason) {
tests_done_elem.innerHTML = exit_code.toString();
document.body.appendChild(tests_done_elem);

// need to flush streams (stdout/stderr)
for (const stream of Module.FS.streams) {
if (stream && stream.stream_ops && stream.stream_ops.flush) {
stream.stream_ops.flush(stream);
console.log('WS: ' + messsage);
originalConsole.log('CDP: ' + messsage);
const stop_when_ws_buffer_empty = () => {
if (consoleWebSocket.bufferedAmount == 0) {
// tell xharness WasmTestMessagesProcessor we are done.
// note this sends last few bytes into the same WS
console.log("WASM EXIT " + exit_code);
}
}
console.log("Flushed stdout!");

console.log('1 ' + messsage);
setTimeout(() => {
originalConsole.log('2 ' + messsage);
// tell xharness WasmTestMessagesProcessor we are done.
console.log("WASM EXIT " + exit_code);
}, 100);
else {
setTimeout(stop_when_ws_buffer_empty, 100);
}
};
stop_when_ws_buffer_empty();

} else if (INTERNAL) {
INTERNAL.mono_wasm_exit(exit_code);
}
Expand Down