-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm] Fix up conditions to trigger relink, and require wasm-tools workload
#89754
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ea1a43e
Remove old hack
radical 14de9e2
[wasm] Fix up conditions to relink
radical d99d7ba
tests.browser.targets: Use WasmNativeStrip=false only for AOT. This a…
radical 1393670
WBT: Update tests for properties that trigger relinking
radical 84a6b2f
WorkloadManifest.targets: Add new property checks to trigger workload…
radical fa69887
[wasm] WorkloadManifest.targets - net8 only knows about WasmEnableThr…
radical 8087a32
WasmApp.Native.targets: Rationalize WasmNativeDebugSymbols, and WasmN…
radical 4a5d3d3
cleanup
radical 34e84d0
Merge remote-tracking branch 'origin/main' into wasm-strip-native
radical 1921e75
add missing file
radical 25b0cb6
cleanup
radical 61c8895
Merge branch 'main' into wasm-strip-native
radical b23d61e
Merge branch 'main' into wasm-strip-native
radical b3a0f44
Merge remote-tracking branch 'origin/main' into wasm-strip-native
radical 0249180
[wasm] Do *not* require workload when settign WasmEnableSIMD=true
radical File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using Xunit; | ||
| using Xunit.Abstractions; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Wasm.Build.Tests.Blazor; | ||
|
|
||
| public class WorkloadRequiredTests : BlazorWasmTestBase | ||
| { | ||
| /* Keep in sync with settings in wasm.proj, and WasmApp.Native.targets . | ||
| * The `triggerValue` here is opposite of the default used when building the runtime pack | ||
| * (see wasm.proj), and thus requiring a native build | ||
| */ | ||
| public static (string propertyName, bool triggerValue)[] PropertiesWithTriggerValues = new[] | ||
| { | ||
| ("RunAOTCompilation", true), | ||
| ("WasmEnableLegacyJsInterop", false), | ||
| ("WasmEnableSIMD", false), | ||
| ("WasmEnableExceptionHandling", false), | ||
| ("InvariantTimezone", true), | ||
| ("InvariantGlobalization", true), | ||
| ("WasmNativeStrip", false) | ||
| }; | ||
|
|
||
| public WorkloadRequiredTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) | ||
| : base(output, buildContext) | ||
| { | ||
| } | ||
|
|
||
| public static TheoryData<string, string, bool> SettingDifferentFromValuesInRuntimePack(bool forPublish) | ||
| { | ||
| TheoryData<string, string, bool> data = new(); | ||
|
|
||
| string[] configs = new[] { "Debug", "Release" }; | ||
| foreach (var defaultPair in PropertiesWithTriggerValues) | ||
| { | ||
| foreach (string config in configs) | ||
| { | ||
| data.Add(config, $"<{defaultPair.propertyName}>{defaultPair.triggerValue}</{defaultPair.propertyName}>", true); | ||
| data.Add(config, $"<{defaultPair.propertyName}>{!defaultPair.triggerValue}</{defaultPair.propertyName}>", false); | ||
| } | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
| [Theory, TestCategory("no-workload")] | ||
| [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: false)] | ||
| public void WorkloadRequiredForBuild(string config, string extraProperties, bool workloadNeeded) | ||
| => CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: false); | ||
|
|
||
| [Theory, TestCategory("no-workload")] | ||
| [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: false)] | ||
| public void WorkloadRequiredForPublish(string config, string extraProperties, bool workloadNeeded) | ||
| => CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: true); | ||
|
|
||
| private void CheckWorkloadRequired(string config, string extraProperties, bool workloadNeeded, bool publish) | ||
| { | ||
| string id = $"props_req_workload_{(publish ? "publish" : "build")}_{GetRandomId()}"; | ||
| string projectFile = CreateWasmTemplateProject(id, "blazorwasm"); | ||
| AddItemsPropertiesToProject(projectFile, extraProperties, | ||
| atTheEnd: @"<Target Name=""StopBuildBeforeCompile"" BeforeTargets=""Compile""> | ||
| <Error Text=""Stopping the build"" /> | ||
| </Target>"); | ||
|
|
||
| CommandResult result; | ||
| if (publish) | ||
| (result, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); | ||
| else | ||
| (result, _) = BlazorBuild(new BlazorBuildOptions(id, config, ExpectSuccess: false)); | ||
|
|
||
| if (workloadNeeded) | ||
| { | ||
| Assert.Contains("following workloads must be installed: wasm-tools", result.Output); | ||
| Assert.DoesNotContain("error : Stopping the build", result.Output); | ||
| } | ||
| else | ||
| { | ||
| Assert.DoesNotContain("following workloads must be installed: wasm-tools", result.Output); | ||
| Assert.Contains("error : Stopping the build", result.Output); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.