[wasm] WBT fixes, and rationalization to allow improved testing (#89360)
authorAnkit Jain <radical@gmail.com>
Tue, 25 Jul 2023 15:32:39 +0000 (11:32 -0400)
committerGitHub <noreply@github.com>
Tue, 25 Jul 2023 15:32:39 +0000 (11:32 -0400)
commit12396a392cb3ea546f070b24687dc8b50bc28547
treee8170e1f707c30f162b7cd25c4f2b82762060bdf
parentf91deff530e9315c28fb38d066f957f0d41b9879
[wasm] WBT fixes, and rationalization to allow improved testing (#89360)

* Move DotNetFileName.cs, and TestUtils.cs to Common

* Move some types from BuildTestBase.cs to separate files

- FileStat
- BuildPaths
- BlazorBuildOptions
- GlobalizationMode

* Move AssertTestMainJsAppBundleOptions.cs to Common

* Instead of globalizationMode=null use GlobalizationMode.Default

* Merge behaviors for the various project types

- Move parsing bootjson, checking icu assets, symbols to ProviderBase, so it can
  be used by all the project types. These come from WasmAppBuilder which
  is shared by all the projects.

- Instead of multiple separate ways to build the project, use one
  `BuildTestBase.BuildWithoutAssert` method that uses `DotNetCommand` to
  build. And all the project types can use this.
  - This allows having any build customizations or fixes to be in once
    place, and the outputs to be consistent.

- Instead of having `UseWebcil` in various option types, use it directly
  as needed, because this setting is *not* changed per test, rather it
  is fixed per run.

- Rationalize figuring out bin framework directories

Known limitations:
- Wasm template tests use a TestMainJs provider to assert the bundle
  because the templates are not yet based on wasm sdk.
- Blazor has a bug due to which all the icu assets get deployed
  irrespective of settings, so asserting that is disabled.
- Also, blazor does not yet support symbols file.

* Update tests to track api changes
* CI: don't trigger jobs when WasmBuild.sln changes

* Address feedback from @ilonatommy
* Address feedback from @ilonatommy - simplify icu assert code
32 files changed:
eng/pipelines/common/evaluate-default-paths.yml
src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs
src/mono/wasm/Wasm.Build.Tests/AssertTestMainJsAppBundleOptions.cs [deleted file]
src/mono/wasm/Wasm.Build.Tests/AssertWasmSdkBundleOptions.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmProjectProvider.cs
src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs
src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs
src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs
src/mono/wasm/Wasm.Build.Tests/BuildProjectOptions.cs
src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
src/mono/wasm/Wasm.Build.Tests/Common/AssertBundleOptionsBase.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Common/AssertTestMainJsAppBundleOptions.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
src/mono/wasm/Wasm.Build.Tests/Common/BuildPaths.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Common/DotNetFileName.cs [moved from src/mono/wasm/Wasm.Build.Tests/DotNetFileName.cs with 100% similarity]
src/mono/wasm/Wasm.Build.Tests/Common/FileStat.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Common/GlobalizationMode.cs [new file with mode: 0644]
src/mono/wasm/Wasm.Build.Tests/Common/TestUtils.cs [moved from src/mono/wasm/Wasm.Build.Tests/TestUtils.cs with 100% similarity]
src/mono/wasm/Wasm.Build.Tests/HostRunner/IHostRunner.cs
src/mono/wasm/Wasm.Build.Tests/IcuShardingTests.cs
src/mono/wasm/Wasm.Build.Tests/InvariantGlobalizationTests.cs
src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/NativeRebuildTestsBase.cs
src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs
src/mono/wasm/Wasm.Build.Tests/RebuildTests.cs
src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs
src/mono/wasm/Wasm.Build.Tests/TestMainJsProjectProvider.cs
src/mono/wasm/Wasm.Build.Tests/TestMainJsTestBase.cs
src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs
src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs
src/mono/wasm/sln/WasmBuild.sln