Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm][libs] Fix WasmAppHost, and AppBundle for library tests #77719

Merged
merged 21 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d43bdc4
Removed fixed path separator + duplicated `browser-wasm`.
ilonatommy Oct 25, 2022
913c484
Working fix.
ilonatommy Nov 1, 2022
1d56d6d
Fix for different `OutputPath` conventions.
ilonatommy Nov 2, 2022
9b77570
Fixing the url printed on the console.
ilonatommy Nov 14, 2022
7f1d5b4
`ProcessQueryArguments` in test-main.js forces debug to be the 1st arg.
ilonatommy Nov 15, 2022
bd80440
Removing special case for WBT.
ilonatommy Nov 23, 2022
114794d
Merge branch 'main' into fix-paths-76721
ilonatommy Jan 10, 2023
9e5e6e6
Merge branch 'main' into fix-paths-76721
ilonatommy Jan 17, 2023
8b42506
We cannot skip checking for missing browser-wasm.
ilonatommy Jan 21, 2023
d0e7e14
Both runArgs and queryArgs are important when running tests.
ilonatommy Jan 25, 2023
0e79616
Revert changes in the shipped targets and move them to tests targets.
ilonatommy Jan 25, 2023
41d8c15
Update src/mono/wasm/host/BrowserArguments.cs
ilonatommy Jan 25, 2023
b76bd9c
Fetch does not work for node<18 => get rid of json.
ilonatommy Jan 26, 2023
bda0ebb
Separated runtime args from app args for both hosts.
ilonatommy Jan 26, 2023
9a82e27
Merge branch 'main' into fix-paths-76721
ilonatommy Jan 26, 2023
af46992
Revert 7.0 file.
ilonatommy Jan 27, 2023
dae5d74
Focusing on enabling libs debugging for browser.
ilonatommy Jan 27, 2023
12f069a
Should have been reverted with dae5d7460c3a23b108e1d141e72c3b0bcdc9d730.
ilonatommy Jan 27, 2023
a4b2857
Fix CI lib tests: avoid referencing undefined properties.
ilonatommy Jan 30, 2023
39be370
In all the cases runArgs should be first populated by defaults that c…
ilonatommy Jan 30, 2023
ef66826
Update src/mono/wasm/test-main.js
ilonatommy Jan 31, 2023
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
5 changes: 3 additions & 2 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
('$(ContinuousIntegrationBuild)' != 'true' or Exists('/.dockerenv')) and
'$(Scenario)' == 'WasmTestOnBrowser'">true</InstallChromeForTests>
<_XHarnessTestsTimeout>00:30:00</_XHarnessTestsTimeout>
<RunWorkingDirectory>$(BundleDir)</RunWorkingDirectory>
</PropertyGroup>

<!-- On CI this is installed as part of pretest, but it should still be installed
Expand Down Expand Up @@ -139,10 +140,10 @@
<BundleTestWasmAppDependsOn Condition="'$(IsBrowserWasmProject)' == 'true' and '$(BuildAOTTestsOn)' == 'local'">WasmTriggerPublishApp</BundleTestWasmAppDependsOn>
<BundleTestWasmAppDependsOn Condition="'$(IsBrowserWasmProject)' == 'true' and '$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn>

<RunCommand>$(WasmAppHostDir)/WasmAppHost</RunCommand>
<!-- Use BundleDir here, since WasmAppDir is set in a target, and `dotnet run` reads
$(Run*) without running any targets -->
<RunArguments>--runtime-config $(BundleDir)/WasmTestRunner.runtimeconfig.json $(WasmHostArguments) $(StartArguments) $(WasmXHarnessMonoArgs) $(_AppArgs)</RunArguments>
<_RuntimeConfigJsonPath>$([MSBuild]::NormalizePath($(BundleDir), 'WasmTestRunner.runtimeconfig.json'))</_RuntimeConfigJsonPath>
<RunArguments>exec &quot;$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))&quot; --runtime-config &quot;$(_RuntimeConfigJsonPath)&quot; $(WasmHostArguments) $(StartArguments) $(WasmXHarnessMonoArgs) $(_AppArgs)</RunArguments>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
Expand Down
32 changes: 16 additions & 16 deletions src/mono/wasm/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/*****************************************************************************
* Please don't use this as template for startup code.
* There are simpler and better samples like src\mono\sample\wasm\browser\main.js
* This one is not ES6 nor CJS, doesn't use top level await and has edge case polyfills.
* This one is not ES6 nor CJS, doesn't use top level await and has edge case polyfills.
* It handles strange things which happen with XHarness.
****************************************************************************/

Expand Down Expand Up @@ -63,19 +63,21 @@ async function getArgs() {
queryArguments = Array.from(WScript.Arguments);
}

let runArgs;
if (queryArguments.length > 0) {
runArgs = processArguments(queryArguments);
} else {
const response = fetch('/runArgs.json')
if (!response.ok) {
console.debug(`could not load /args.json: ${response.status}. Ignoring`);
let runArgsJson;
// ToDo: runArgs should be read for all kinds of hosts, but
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please open an issue to track this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// fetch is added to node>=18 and current Windows's emcc node<18
if (is_browser)
{
const response = await globalThis.fetch('./runArgs.json');
if (response.ok) {
runArgsJson = initRunArgs(await response.json());
} else {
console.debug(`could not load /runArgs.json: ${response.status}. Ignoring`);
}
runArgs = await response.json();
}
runArgs = initRunArgs(runArgs);

return runArgs;
if (!runArgsJson)
runArgsJson = initRunArgs({});
return processArguments(queryArguments, runArgsJson);
}

function initRunArgs(runArgs) {