-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Adding browser-wasm trimming test leg #48429
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @safern, @ViktorHofer Issue Detailscc: @eerhardt @safern @marek-safar contributes to #39274 This will add the execution of browser-wasm trimming tests. I have tested this locally and only have 4 remaining failing tests which I have to investigate, but I'm sending the PR in the meantime to start getting some feedback.
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @tannergooding, @sbomer Issue Detailscc: @eerhardt @safern @marek-safar contributes to #39274 This will add the execution of browser-wasm trimming tests. I have tested this locally and only have 4 remaining failing tests which I have to investigate, but I'm sending the PR in the meantime to start getting some feedback.
|
a644dfa
to
53e89e8
Compare
...aries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj
Outdated
Show resolved
Hide resolved
Curious, what was the overall reason to not import the msbuild files from the repository? |
Same reason our packaging tests currently won't import our own infrastructure for building: The whole point of these tests is for them to build as close as possible to how real consumer apps would be built (using built-in SDK targets and props only) with the only difference that we wanted to override the framework they build and run against to instead use the one we are currently live-building. The difference why we are in here adding partial set of those files here is that the logic within the files we are importing (all of the logic in test-mobile.targets) doesn't really exist on the sdk and in order to avoid the duplication of targets of how to build wasm appbundles we decided to instead reuse only those set of targets as part of these project build. |
Thanks for the clarification Joe. It would be great if #48462 could be merged first as it currently blocks Arcade's validation builds and dependency flow into runtime. |
Yeah, looks like I'll have to fix one more thing on the docker image first as it looks like the user running our builds doesn't have access to v8 as all trimming tests are failing with |
@@ -12,7 +14,7 @@ | |||
<Target Name="UpdateRuntimePack" | |||
AfterTargets="ResolveFrameworkReferences"> | |||
<ItemGroup> | |||
<ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(RuntimePackDir)" /> | |||
<ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(MicrosoftNetCoreAppRuntimePackRidDir)/../../" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be $(MicrosoftNetCoreAppRuntimePackDir)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do that, then I need to pass in the two properties (MicrosoftNetCoreAppRuntimePackRidDir and MicrosoftNetCoreAppRuntimePackDir) since the one that the Wasm targets read is the Rid-specific one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which I'm fine if we want to do that, but I thought the idea was to avoid duplication of properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just feels like there should be one base property that needs to be set, and everything flows from there. If not, then I'm fine with what you have now.
@joperezr - is there a reason CI isn't running on this change? |
It was running before, no idea why it didn't run on my latest commit. I won't trigger it manually for now since I know I'll need dotnet/dotnet-buildtools-prereqs-docker#412 to get merged before I can get the wasm tests to pass. |
...aries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj
Show resolved
Hide resolved
Why can you not do that? We publish for browser-wasm in other tests so I don't fully understand the problem here. |
You can publish for browser-wasm, I guess what @eerhardt meant is that you can't really run a console app published for browser-wasm just on its own. Instead you need to be able to load it in either a browser or on an engine (like v8) so the complaint here is that it would be ideal if the SDK could automatically 'pack' an AppBundle for an engine like v8 so that you could just do something like:
Of course this is not a mainline scenario as most people that target browser wasm will likely be doing |
@joperezr it's actually one of our supported scenarios. I don't have deep insight into the difference compared to your setup but https://github.com/dotnet/runtime/blob/master/src/tests/FunctionalTests/wasm/Interpreter/console/Wasm.Interpreter.Console.Test.csproj works and @akoeplinger, @radical can provide more details. |
@akoeplinger, @radical can you show me how to do it with only using an SDK installed from https://github.com/dotnet/installer#installers-and-binaries and without custom MSBuild tasks/targets? My understanding is that this only works for console apps that are using the runtime/src/tests/FunctionalTests/Directory.Build.props Lines 1 to 11 in afa7e27
runtime/src/tests/FunctionalTests/Directory.Build.targets Lines 1 to 3 in afa7e27
|
ee70bf7
to
fb073e5
Compare
Your concern is valid @ViktorHofer and something we have thought about. We do however specifically don't want to import the rest of the infrastructure from runtime in these tests as it would be very easy to run into a case where settings made on the build infra (which does change trimming-related settings) would "loosen" how trimming happens and make the tests to silently pass when they should have failed and our customers would be broken. I know originally these targets weren't really meant to be used in isolation, but it actually didn't require many global properties to be set (which are basically the ones that are getting passed down to the template in this PR) and if new dependencies on global properties are added it would be easy to catch as the linker test CI would be broken. In terms of isolating the file more to just have what we need, that is about 95% of the file, so basically everything except for this: runtime/eng/testing/tests.mobile.targets Lines 165 to 188 in 121b732
which is actually something we specifically want to make sure it doesn't run, but today that is the case as this target is opt-in and the condition is false today. |
You can't do it just with just the sdk right now. But it is possible to build non-blazorwasm projects out of the tree. See https://github.com/radical/blazor-wasm-test/tree/main/console-out-of-tree . With the current master, you will also need a little patch: diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.props b/src/mono/wasm/build/WasmApp.LocalBuild.props
index b545e5764d8..145e315cc00 100644
--- a/src/mono/wasm/build/WasmApp.LocalBuild.props
+++ b/src/mono/wasm/build/WasmApp.LocalBuild.props
@@ -45,7 +45,7 @@
<PropertyGroup>
<MicrosoftNetCoreAppRuntimePackRidDir>$(MicrosoftNetCoreAppRuntimePackLocationToUse)runtimes\browser-wasm\</MicrosoftNetCoreAppRuntimePackRidDir>
- <MonoAotCrossCompilerPath>$(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\$(RuntimeIdentifier)\mono-aot-cross</MonoAotCrossCompilerPath>
+ <MonoAotCrossCompilerPath>$(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\browser-wasm\mono-aot-cross</MonoAotCrossCompilerPath>
<MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(MonoAotCrossCompilerPath).exe</MonoAotCrossCompilerPath>
<WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets
index d041b0a5aac..67010c876b4 100644
--- a/src/mono/wasm/build/WasmApp.targets
+++ b/src/mono/wasm/build/WasmApp.targets
@@ -157,7 +157,7 @@
<WasmBuildNative Condition="'$(RunAOTCompilation)' == 'true'">true</WasmBuildNative>
<WasmAppDir Condition="'$(WasmAppDir)' == ''">$(OutputPath)AppBundle\</WasmAppDir>
<WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">$(TargetFileName)</WasmMainAssemblyFileName>
- <MonoAotCrossCompilerPath Condition="'$(MonoAotCrossCompilerPath)' == ''">$(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\$(PackageRID)\mono-aot-cross$(_ExeExt)</MonoAotCrossCompilerPath>
+ <MonoAotCrossCompilerPath Condition="'$(MonoAotCrossCompilerPath)' == ''">$(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\browser-wasm\mono-aot-cross$(_ExeExt)</MonoAotCrossCompilerPath>
<!-- emcc, and mono-aot-cross don't like relative paths for output files -->
<_WasmIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)\wasm\'))</_WasmIntermediateOutputPath> Follow the steps in the README.md to build, and then |
We have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Thanks for the good work here, @joperezr!
Hello @joperezr! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Fixes #48027
cc: @eerhardt @safern @marek-safar
contributes to #39274
This will add the execution of browser-wasm trimming tests. I have tested this locally and only have 4 remaining failing tests which I have to investigate, but I'm sending the PR in the meantime to start getting some feedback.