Skip to content
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

[Xamarin.Android.Build.Tests] Ignore AOT tests if compiler is not available. #855

Merged
merged 1 commit into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ public partial class BuildTest : BaseTest
{
#pragma warning disable 414
static object [] AotChecks = new object [] {
new object[] {
/* supportedAbis */ "armeabi",
/* enableLLVM */ false,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "armeabi",
/* enableLLVM */ true,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "armeabi-v7a",
/* enableLLVM */ false,
Expand All @@ -23,6 +33,16 @@ public partial class BuildTest : BaseTest
/* enableLLVM */ true,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "arm64-v8a",
/* enableLLVM */ false,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "arm64-v8a",
/* enableLLVM */ true,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "x86",
/* enableLLVM */ false,
Expand All @@ -33,6 +53,16 @@ public partial class BuildTest : BaseTest
/* enableLLVM */ true,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "x86_64",
/* enableLLVM */ false,
/* expectedResult */ true,
},
new object[] {
/* supportedAbis */ "x86_64",
/* enableLLVM */ true,
/* expectedResult */ true,
},
};

static object [] ProguardChecks = new object [] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ public void BuildAotApplication (string supportedAbis, bool enableLLVM, bool exp
}
using (var b = CreateApkBuilder (path)) {
if (!b.CrossCompilerAvailable (supportedAbis))
Assert.Ignore ("Cross compiler was not available");
Assert.Ignore ($"Cross compiler for {supportedAbis} was not available");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I'm missing something, but if we Assert.Ignore() shouldn't we also immediately return so that we don't continue execution? (Or does Assert.Ignore() work by throwing an exception, thus exiting immediately? The documentation doesn't say.)

if (!b.GetSupportedRuntimes ().Any (x => supportedAbis == x.Abi))
Assert.Ignore ($"Runtime for {supportedAbis} was not available.");
b.ThrowOnBuildFailure = false;
b.Verbosity = LoggerVerbosity.Diagnostic;
Assert.AreEqual (expectedResult, b.Build (proj), "Build should have {0}.", expectedResult ? "succeeded" : "failed");
Expand Down Expand Up @@ -281,6 +283,8 @@ public void BuildAotApplicationAndBundle (string supportedAbis, bool enableLLVM,
using (var b = CreateApkBuilder (path)) {
if (!b.CrossCompilerAvailable (supportedAbis))
Assert.Ignore ("Cross compiler was not available");
if (!b.GetSupportedRuntimes ().Any (x => supportedAbis == x.Abi))
Assert.Ignore ($"Runtime for {supportedAbis} was not available.");
b.ThrowOnBuildFailure = false;
Assert.AreEqual (expectedResult, b.Build (proj), "Build should have {0}.", expectedResult ? "succeeded" : "failed");
if (!expectedResult)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using NUnit.Framework;
using Xamarin.ProjectTools;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using Xamarin.Tools.Zip;

namespace Xamarin.Android.Build.Tests
{
public partial class ManifestTest : BaseTest
{
static object [] DebuggerAttributeCases = new object [] {
// DebugType, isRelease, extpected
new object[] { "", true, false, },
new object[] { "", false, true, },
new object[] { "None", true, false, },
new object[] { "None", false, false, },
new object[] { "PdbOnly", true, false, },
new object[] { "PdbOnly", false, true, },
new object[] { "Full", true, false, },
new object[] { "Full", false, true, },
new object[] { "Portable", true, false, },
new object[] { "Portable", false, true, },
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Xamarin.Android.Build.Tests
{
public class ManifestTest : BaseTest
public partial class ManifestTest : BaseTest
{
readonly string TargetSdkManifest = @"<?xml version=""1.0"" encoding=""utf-8""?>
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""Bug12935.Bug12935"">
Expand Down Expand Up @@ -436,20 +436,6 @@ public void ManifestPlaceHolders2 ()
}
}

static object[] DebuggerAttributeCases = new object[] {
// DebugType, isRelease, extpected
new object[] { "", true, false, },
new object[] { "", false, true, },
new object[] { "None", true, false, },
new object[] { "None", false, false, },
new object[] { "PdbOnly", true, false, },
new object[] { "PdbOnly", false, true, },
new object[] { "Full", true, false, },
new object[] { "Full", false, true, },
new object[] { "Portable", true, false, },
new object[] { "Portable", false, true, },
};

[Test]
[TestCaseSource ("DebuggerAttributeCases")]
public void DebuggerAttribute (string debugType, bool isRelease, bool expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BuildTest.OSS.cs" />
<Compile Include="ManifestTest.OSS.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public RuntimeInfo [] GetSupportedRuntimes ()
var runtimeInfo = new List<RuntimeInfo> ();
var outdir = FrameworkLibDirectory;
var path = Path.Combine (outdir, IsUnix ? Path.Combine ("xbuild", "Xamarin", "Android", "lib") : "");
foreach (var file in Directory.EnumerateFiles (path, "libmono-android.*.*.so", SearchOption.AllDirectories)) {
foreach (var file in Directory.EnumerateFiles (path, "libmono-android.*.so", SearchOption.AllDirectories)) {
string fullFilePath = Path.GetFullPath (file);
DirectoryInfo parentDir = Directory.GetParent (fullFilePath);
if (parentDir == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">MonoAndroid</TargetFrameworkIdentifier>
<MonoAndroidVersion>v$(_XAMajorVersionNumber).0</MonoAndroidVersion>
<AndroidUpdateResourceReferences Condition="'$(AndroidUpdateResourceReferences)' == ''">True</AndroidUpdateResourceReferences>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' Or '$(_XASupportsFastDev)' == 'False' ">True</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' And '$(Optimize)' != 'True' And '$(_XASupportsFastDev)' == 'True' ">False</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(_XASupportsFastDev)' == 'False' ">True</EmbedAssembliesIntoApk>
<AndroidPreferNativeLibrariesWithDebugSymbols Condition=" '$(AndroidPreferNativeLibrariesWithDebugSymbols)' == '' ">False</AndroidPreferNativeLibrariesWithDebugSymbols>
<AndroidSkipJavacVersionCheck Condition="'$(AndroidSkipJavacVersionCheck)' == ''">False</AndroidSkipJavacVersionCheck>
<AndroidBuildApplicationPackage Condition=" '$(AndroidBuildApplicationPackage)' == ''">False</AndroidBuildApplicationPackage>
Expand Down