Skip to content

Commit 15d87f9

Browse files
committed
Another portion of fixes, hopefully
1 parent 852dacc commit 15d87f9

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

+5
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ public static string GetLinkedPath (ProjectBuilder builder, bool isRelease, stri
357357
[Test]
358358
[TestCaseSource (nameof (RuntimeChecks))]
359359
public void CheckWhichRuntimeIsIncluded (string supportedAbi, bool debugSymbols, bool? optimize, bool? embedAssemblies, string expectedRuntime) {
360+
361+
if (TargetRuntimeHelper.UseCoreCLR && !TargetRuntimeHelper.CoreClrSupportsAllABIs (supportedAbi)) {
362+
Assert.Ignore ($"ABI '{supportedAbi}' not supported on CoreCLR");
363+
}
364+
360365
var proj = new XamarinAndroidApplicationProject ();
361366
proj.SetAndroidSupportedAbis (supportedAbi);
362367
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugSymbols", debugSymbols);

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ public void CasingOnJavaLangObject ()
983983
}
984984

985985
[Test]
986+
[Category ("CoreCLR")]
986987
public void GenerateJavaStubsAndAssembly ([Values (true, false)] bool isRelease)
987988
{
988989
var targets = new [] {
@@ -992,7 +993,7 @@ public void GenerateJavaStubsAndAssembly ([Values (true, false)] bool isRelease)
992993
var proj = new XamarinAndroidApplicationProject {
993994
IsRelease = isRelease,
994995
};
995-
proj.SetAndroidSupportedAbis ("armeabi-v7a");
996+
proj.SetAndroidSupportedAbis ("arm64-v8a");
996997
proj.OtherBuildItems.Add (new AndroidItem.AndroidEnvironment ("Foo.txt") {
997998
TextContent = () => "Foo=Bar",
998999
});
@@ -1024,11 +1025,11 @@ public void GenerateJavaStubsAndAssembly ([Values (true, false)] bool isRelease)
10241025
}
10251026

10261027
readonly string [] ExpectedAssemblyFiles = new [] {
1027-
Path.Combine ("android", "environment.armeabi-v7a.o"),
1028-
Path.Combine ("android", "environment.armeabi-v7a.ll"),
1029-
Path.Combine ("android", "typemaps.armeabi-v7a.o"),
1030-
Path.Combine ("android", "typemaps.armeabi-v7a.ll"),
1031-
Path.Combine ("app_shared_libraries", "armeabi-v7a", "libxamarin-app.so")
1028+
Path.Combine ("android", "environment.arm64-v8a.o"),
1029+
Path.Combine ("android", "environment.arm64-v8a.ll"),
1030+
Path.Combine ("android", "typemaps.arm64-v8a.o"),
1031+
Path.Combine ("android", "typemaps.arm64-v8a.ll"),
1032+
Path.Combine ("app_shared_libraries", "arm64-v8a", "libxamarin-app.so")
10321033
};
10331034

10341035
void AssertAssemblyFilesInFileWrites (XamarinAndroidApplicationProject proj, ProjectBuilder b)

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/AssertionExtensions.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,14 @@ public static void AssertEntryContents (this ZipArchive zip, string zipPath, str
129129
static void AllowCoreCLRWarning (IEnumerable<string> lastBuildOutput, string logFile)
130130
{
131131
// With CoreCLR being experimental, we allow a single warning (XA1040)
132-
Assert.IsTrue (StringAssertEx.ContainsText (lastBuildOutput, " 1 Warning(s)"), $"{logFile} should have at most 1 MSBuild warning.");
133-
Assert.True (StringAssertEx.ContainsText (lastBuildOutput, "XA1040"), "Should receive XA1040 warning");
132+
// Library builds won't have warnings, though, so we must account for that too.
133+
bool hasNoWarnings = StringAssertEx.ContainsText (lastBuildOutput, " 0 Warning(s)");
134+
bool hasOneWarning = StringAssertEx.ContainsText (lastBuildOutput, " 1 Warning(s)");
135+
136+
Assert.IsTrue (hasNoWarnings || hasOneWarning, $"{logFile} should have at most 1 MSBuild warning.");
137+
if (hasOneWarning) {
138+
Assert.True (StringAssertEx.ContainsText (lastBuildOutput, "XA1040"), "Should receive XA1040 warning");
139+
}
134140
}
135141

136142
[DebuggerHidden]

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,17 @@ static void AssertSharedLibraryHasRequiredSymbols (string dsoPath, string readEl
534534
symbols.Add (symbolName);
535535
}
536536

537-
foreach (string symbol in requiredSharedLibrarySymbols) {
538-
Assert.IsTrue (symbols.Contains (symbol), $"Symbol '{symbol}' is missing from '{dsoPath}'");
537+
if (TargetRuntimeHelper.UseMonoRuntime) {
538+
EnsureSymbols (requiredSharedLibrarySymbols);
539+
} else if (TargetRuntimeHelper.UseCoreCLR) {
540+
EnsureSymbols (requiredSharedLibrarySymbolsCLR);
541+
}
542+
543+
void EnsureSymbols (IEnumerable<string> requiredSymbols)
544+
{
545+
foreach (string symbol in requiredSymbols) {
546+
Assert.IsTrue (symbols.Contains (symbol), $"Symbol '{symbol}' is missing from '{dsoPath}'");
547+
}
539548
}
540549
}
541550

0 commit comments

Comments
 (0)