Skip to content
54 changes: 6 additions & 48 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,9 @@ stages:
condition: and(eq(dependencies.mac_build.result, 'Succeeded'), eq(variables['RunAllTests'], true))
jobs:

# Check - "Xamarin.Android (Regression Tests Mac-1)"
- job: integrated_regression_mac_1
displayName: Mac-1
# Check - "Xamarin.Android (Regression Tests Mac)"
- job: integrated_regression_mac
displayName: Mac
pool:
name: VSEng-Xamarin-Mac-Devices
demands:
Expand All @@ -1121,50 +1121,10 @@ stages:
clean: all
steps:
- template: yaml-templates/run-integrated-regression-tests.yaml
parameters:
node_id: 1

# Check - "Xamarin.Android (Regression Tests Mac-2)"
- job: integrated_regression_mac_2
displayName: Mac-2
pool:
name: VSEng-Xamarin-Mac-Devices
demands:
- android
timeoutInMinutes: 240
cancelTimeoutInMinutes: 5
workspace:
clean: all
steps:
- template: yaml-templates/run-integrated-regression-tests.yaml
parameters:
node_id: 2

# Check - "Xamarin.Android (Regression Tests Windows-1)"
- job: integrated_regression_Win_1
displayName: Windows-1
pool:
name: VSEng-Xamarin-Win-XMA
demands:
- android
timeoutInMinutes: 240
cancelTimeoutInMinutes: 5
workspace:
clean: all
variables:
XQA_VISUALSTUDIO_LOCATION: '%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise'
steps:
- template: remove-visualstudio.yml@yaml

- template: yaml-templates\run-integrated-regression-tests.yaml
parameters:
node_id: 1

- template: remove-visualstudio.yml@yaml

# Check - "Xamarin.Android (Regression Tests Windows-2)"
- job: integrated_regression_Win_2
displayName: Windows-2
# Check - "Xamarin.Android (Regression Tests Windows)"
- job: integrated_regression_win
displayName: Windows
pool:
name: VSEng-Xamarin-Win-XMA
demands:
Expand All @@ -1179,8 +1139,6 @@ stages:
- template: remove-visualstudio.yml@yaml

- template: yaml-templates\run-integrated-regression-tests.yaml
parameters:
node_id: 2

- template: remove-visualstudio.yml@yaml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
parameters:
node_id: 0

steps:
- task: xamops.azdevex.lingering-process-task.lingering-process-task@1

Expand Down Expand Up @@ -67,112 +64,47 @@ steps:
}
displayName: Test Environment Setup

- ${{ if eq(parameters.node_id, 1) }}:
- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Mono.Android-Tests Debug on Device
nunitConsoleExtraArgs: --where "cat == RuntimeTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Hello Tests on Device
nunitConsoleExtraArgs: --where "cat == Hello"
condition: and(succeeded(), eq(variables['XA.Commercial.Build'], 'true'))

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Smoke Tests on Device
nunitConsoleExtraArgs: --where "cat == RegressionDeviceTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Incremental Build Tests
nunitConsoleExtraArgs: --where "cat == BuildPerformance"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: AOT Tests
nunitConsoleExtraArgs: --where "cat == AotSupport"

- ${{ if eq(parameters.node_id, 2) }}:
- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Proguard Tests
nunitConsoleExtraArgs: --where "cat == Proguard"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Multidex Tests
nunitConsoleExtraArgs: --where "cat == Multidex"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: ExplicitCrunch Tests
nunitConsoleExtraArgs: --where "cat == ExplicitCrunch"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: TargetFrameworkVersion Tests
nunitConsoleExtraArgs: --where "cat == TargetFrameworkTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Resource Cache Tests
nunitConsoleExtraArgs: --where "cat == ResourceCacheTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Property Cache Tests
nunitConsoleExtraArgs: --where "cat == PropertyCacheTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Code Analysis Tests
nunitConsoleExtraArgs: --where "cat == CodeAnalysisTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Networking Options Tests
nunitConsoleExtraArgs: --where "cat == HttpClientAndTlsProviderPackageTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: AndroidApiInfo Tests
nunitConsoleExtraArgs: --where "cat == AndroidApiInfoTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Test Environment Cleanup
nunitConsoleExtraArgs: --where "cat == XATestCleanUp"
- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Mono.Android-Tests Debug on Device
nunitConsoleExtraArgs: --where "cat == RuntimeTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Hello Tests on Device
nunitConsoleExtraArgs: --where "cat == Hello"
condition: and(succeeded(), eq(variables['XA.Commercial.Build'], 'true'))

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Smoke Tests on Device
nunitConsoleExtraArgs: --where "cat == RegressionDeviceTests"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Incremental Build Tests
nunitConsoleExtraArgs: --where "cat == BuildPerformance"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: AOT Tests
nunitConsoleExtraArgs: --where "cat == AotSupport"

- template: run-nunit-tests.yaml
parameters:
nunitConsole: $(System.DefaultWorkingDirectory)/NUnit.ConsoleRunner/tools/nunit3-console.exe
testAssembly: $(System.DefaultWorkingDirectory)/XQA.Android/XQA.Android.dll
testRunTitle: Test Environment Cleanup
nunitConsoleExtraArgs: --where "cat == XATestCleanUp"

- template: fail-on-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@ public void CompressedWithoutLinker ()
}
}

public static string [] SupportedTargetFrameworks ()
{
using (var b = new Builder ()) {
if (Builder.UseDotNet)
return new string [] { b.LatestTargetFrameworkVersion () };
else
return b.GetAllSupportedTargetFrameworkVersions ();
}
}

[Test]
[Category ("dotnet")]
public void BuildBasicApplication ([Values (true, false)] bool isRelease)
public void BuildBasicApplication ([ValueSource (nameof (SupportedTargetFrameworks))] string tfv, [Values (true, false)] bool isRelease)
{
var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
TargetFrameworkVersion = tfv,
};
using (var b = CreateApkBuilder ()) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
Expand Down Expand Up @@ -633,31 +644,6 @@ public CustomTextView(Context context, IAttributeSet attributes) : base(context,
}
}

[Test]
public void BuildPropsBreaksConvertResourcesCases ([Values (true, false)] bool useAapt2)
{
var proj = new XamarinAndroidApplicationProject () {
AndroidResources = {
new AndroidItem.AndroidResource (() => "Resources\\drawable\\IMALLCAPS.png") {
BinaryContent = () => XamarinAndroidApplicationProject.icon_binary_mdpi,
},
new AndroidItem.AndroidResource ("Resources\\layout\\test.axml") {
TextContent = () => {
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ImageView xmlns:android=\"http://schemas.android.com/apk/res/android\" android:src=\"@drawable/IMALLCAPS\" />";
}
}
}
};
proj.SetProperty ("AndroidUseAapt2", useAapt2.ToString ());
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
Assert.IsTrue (b.Build (proj), "first build should have succeeded.");
//Invalidate build.props with newer timestamp, you could also modify anything in @(_PropertyCacheItems)
var props = b.Output.GetIntermediaryPath("build.props");
File.SetLastWriteTimeUtc(props, DateTime.UtcNow);
Assert.IsTrue (b.Build (proj), "second build should have succeeded.");
}
}

[Test]
public void AndroidResourceNotExist ()
{
Expand Down Expand Up @@ -1362,6 +1348,9 @@ public override void OnCreate()
using (var b = CreateApkBuilder ("temp/CustomApplicationClassAndMultiDex")) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
Assert.IsFalse (b.LastBuildOutput.ContainsText ("Duplicate zip entry"), "Should not get warning about [META-INF/MANIFEST.MF]");
var customAppContent = File.ReadAllText (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "src", "com", "foxsports", "test", "CustomApp.java"));
Assert.IsTrue (customAppContent.Contains ("extends android.support.multidex.MultiDexApplication"),
"Custom App class should have inherited from android.support.multidex.MultiDexApplication.");
}
}

Expand Down Expand Up @@ -1687,6 +1676,7 @@ public void BuildBasicApplicationCheckConfigFiles ()
}
}

[Test]
public void BuildApplicationCheckItEmitsAWarningWithContentItems ()
{
var proj = new XamarinAndroidApplicationProject ();
Expand All @@ -1699,12 +1689,10 @@ public void BuildApplicationCheckItEmitsAWarningWithContentItems ()
TextContent = () => "Test Content 1"
});
Assert.IsTrue (b.Build (proj), "Build should have built successfully");
Assert.IsTrue (
b.LastBuildOutput.Contains ("TestContent.txt: warning XA0101: @(Content) build action is not supported"),
"Build Output did not contain the correct error message");
Assert.IsTrue (
b.LastBuildOutput.Contains ("TestContent1.txt: warning XA0101: @(Content) build action is not supported"),
"Build Output did not contain the correct error message");
StringAssertEx.Contains ("TestContent.txt : warning XA0101: @(Content) build action is not supported", b.LastBuildOutput,
"Build Output did not contain 'TestContent.txt : warning XA0101'.");
StringAssertEx.Contains ("TestContent1.txt : warning XA0101: @(Content) build action is not supported", b.LastBuildOutput,
"Build Output did not contain 'TestContent1.txt : warning XA0101'.");
}
}

Expand Down Expand Up @@ -2470,7 +2458,7 @@ public void CheckTargetFrameworkVersion ([Values (true, false)] bool isRelease)
};
proj.SetProperty ("AndroidUseLatestPlatformSdk", "False");
using (var builder = CreateApkBuilder ()) {
builder.GetTargetFrameworkVersionRange (out var _, out string firstFrameworkVersion, out var _, out string lastFrameworkVersion);
builder.GetTargetFrameworkVersionRange (out var _, out string firstFrameworkVersion, out var _, out string lastFrameworkVersion, out string[] _);
proj.SetProperty ("TargetFrameworkVersion", firstFrameworkVersion);
if (!Directory.Exists (Path.Combine (builder.FrameworkLibDirectory, firstFrameworkVersion)))
Assert.Ignore ("This is a Pull Request Build. Ignoring test.");
Expand Down Expand Up @@ -3999,6 +3987,34 @@ public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ()
}
}

[Test]
[Category ("Commercial")]
public void LibraryReferenceWithHigherTFVShouldDisplayWarning ([Values (true, false)] bool isRelease)
{
if (!CommercialBuildAvailable || Builder.UseDotNet)
Assert.Ignore ("Not applicable to One .NET or single framework OSS builds.");

var libproj = new XamarinAndroidLibraryProject () {
IsRelease = isRelease,
ProjectName = "Library1",
};
var proj = new XamarinAndroidApplicationProject () {
IsRelease = isRelease,
ProjectName = "App1",
UseLatestPlatformSdk = false,
TargetFrameworkVersion = "v9.0",
References = {
new BuildItem ("ProjectReference", $"..\\{libproj.ProjectName}\\{Path.GetFileName (libproj.ProjectFilePath)}")
},
};
using (var libBuilder = CreateDllBuilder (Path.Combine ("temp", TestName, libproj.ProjectName)))
using (var appBuilder = CreateApkBuilder (Path.Combine ("temp", TestName, proj.ProjectName))) {
Assert.IsTrue (libBuilder.Build (libproj), "Library build should have succeeded.");
Assert.IsTrue (appBuilder.Build (proj), "App build should have succeeded.");
StringAssertEx.Contains ("warning XA0105", appBuilder.LastBuildOutput, "Build should have produced warning XA0105.");
}
}

[Test]
public void AllResourcesInClassLibrary ([Values (true, false)] bool useAapt2)
{
Expand Down
Loading