-
Notifications
You must be signed in to change notification settings - Fork 569
[NativeAOT] Make workload linker the default for NativeAOT builds #11340
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
Changes from all commits
1aef5e7
d918845
5960224
c37a7a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,36 +12,53 @@ namespace Xamarin.Android.Build.Tests | |
| public class NativeAotBuildTests : BaseTest | ||
| { | ||
| [Test] | ||
| public void BuildNativeAot_WithoutNdk_Fails () | ||
| public void BuildNativeAot_WithoutNdk () | ||
| { | ||
| var proj = new XamarinAndroidApplicationProject { | ||
| IsRelease = true, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.NativeAOT); | ||
|
|
||
| using var builder = CreateApkBuilder (); | ||
| builder.ThrowOnBuildFailure = false; | ||
| Assert.IsFalse ( | ||
| builder.Build (proj, parameters: new [] { "_SkipNdkResolution=true" }), | ||
| "Build should have failed without NDK." | ||
| Assert.IsTrue ( | ||
| builder.Build (proj), | ||
| "Build should succeed without NDK (workload linker is the default)." | ||
| ); | ||
| } | ||
|
|
||
| [Test] | ||
| public void BuildNativeAot_WithWorkloadLinker_WithoutNdk () | ||
| public void BuildNativeAot_WithNdkLinker () | ||
| { | ||
| var proj = new XamarinAndroidApplicationProject { | ||
| IsRelease = true, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.NativeAOT); | ||
| proj.SetProperty ("_SkipNdkResolution", "false"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 💡 Testing — Rule: Deterministic test data |
||
|
|
||
| using var builder = CreateApkBuilder (); | ||
| Assert.IsTrue ( | ||
| builder.Build (proj, parameters: new [] { | ||
| "_SkipNdkResolution=true", | ||
| "_AndroidUseWorkloadNativeLinker=true", | ||
| "_AndroidUseWorkloadNativeLinker=false", | ||
| }), | ||
| "Build should succeed with NDK linker." | ||
| ); | ||
| } | ||
|
|
||
| [Test] | ||
| public void BuildNativeAot_WithoutNdk_WorkloadLinkerDisabled_Fails () | ||
| { | ||
| var proj = new XamarinAndroidApplicationProject { | ||
| IsRelease = true, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.NativeAOT); | ||
|
|
||
| using var builder = CreateApkBuilder (); | ||
| builder.ThrowOnBuildFailure = false; | ||
| Assert.IsFalse ( | ||
| builder.Build (proj, parameters: new [] { | ||
| "_AndroidUseWorkloadNativeLinker=false", | ||
| }), | ||
| "Build should succeed with workload linker and no NDK." | ||
| "Build should fail without NDK when workload linker is disabled." | ||
|
Comment on lines
+47
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 💡 Testing — This test only asserts that the build fails, but doesn't verify why it fails. If a future regression causes the build to fail for an unrelated reason (e.g. a missing runtime pack), this test would still pass, masking the real issue. Consider asserting on a specific error message or error code in the build output, e.g.: Assert.IsFalse (
builder.Build (proj, parameters: new [] {
"_AndroidUseWorkloadNativeLinker=false",
}),
"Build should fail without NDK when workload linker is disabled."
);
StringAssertEx.Contains ("expected-error-string", builder.LastBuildOutput, "Expected NDK-related error.");Rule: Test assertions must be specific |
||
| ); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.