From b1aed00fc661de235ca37d4e27dbf4279e8edd2e Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Thu, 16 Feb 2023 11:59:53 -1000 Subject: [PATCH 1/5] [ci] Use AZDO built-in parallelization strategy. --- build-tools/automation/azure-pipelines.yaml | 47 ++---------- .../stage-msbuild-emulator-tests.yaml | 73 +++++++++++++++++++ 2 files changed, 78 insertions(+), 42 deletions(-) create mode 100644 build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index ef8c0138fbe..961e10b6ad3 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -652,48 +652,11 @@ stages: nunit_categories: $(DotNetNUnitCategories) & TestCategory != SmokeTests target_framework: $(DotNetStableTargetFramework) provisionatorChannel: ${{ parameters.provisionatorChannel }} - -- stage: msbuilddevice_tests - displayName: MSBuild Emulator Tests - dependsOn: mac_build - condition: and(succeeded(), or(eq(variables['RunAllTests'], true), contains(dependencies.mac_build.outputs['mac_build_create_installers.TestConditions.TestAreas'], 'MSBuildDevice'))) - jobs: - # Check - "Xamarin.Android (macOS > Tests > MSBuild+Emulator One .NET #N)" - - template: yaml-templates/run-msbuild-device-tests.yaml - parameters: - node_id: 1 - job_name: mac_dotnetdevice_tests_1 - job_suffix: One .NET - nunit_categories: $(DotNetNUnitCategories) - target_framework: $(DotNetStableTargetFramework) - provisionatorChannel: ${{ parameters.provisionatorChannel }} - - - template: yaml-templates/run-msbuild-device-tests.yaml - parameters: - node_id: 2 - job_name: mac_dotnetdevice_tests_2 - job_suffix: One .NET - nunit_categories: $(DotNetNUnitCategories) - target_framework: $(DotNetStableTargetFramework) - provisionatorChannel: ${{ parameters.provisionatorChannel }} - - - template: yaml-templates/run-msbuild-device-tests.yaml - parameters: - node_id: 3 - job_name: mac_dotnetdevice_tests_3 - job_suffix: One .NET - nunit_categories: $(DotNetNUnitCategories) - target_framework: $(DotNetStableTargetFramework) - provisionatorChannel: ${{ parameters.provisionatorChannel }} - - - template: yaml-templates/run-msbuild-device-tests.yaml - parameters: - node_id: 4 - job_name: mac_dotnetdevice_tests_4 - job_suffix: One .NET - nunit_categories: $(DotNetNUnitCategories) - target_framework: $(DotNetStableTargetFramework) - provisionatorChannel: ${{ parameters.provisionatorChannel }} + +- template: yaml-templates/stage-msbuild-emulator-tests.yaml + parameters: + provisionatorChannel: ${{ parameters.provisionatorChannel }} + stageCondition: and(succeeded(), or(eq(variables['RunAllTests'], true), contains(dependencies.mac_build.outputs['mac_build_create_installers.TestConditions.TestAreas'], 'MSBuildDevice'))) - job: wear_tests displayName: macOS > Tests > WearOS diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml new file mode 100644 index 00000000000..fa5003066d2 --- /dev/null +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -0,0 +1,73 @@ +# Runs MSBuild tests against a device running on macOS + +parameters: + job_name: 'mac_dotnetdevice_tests' + nunit_categories: $(DotNetNUnitCategories) + target_framework: $(DotNetStableTargetFramework) + provisionatorChannel: latest + stageCondition: succeeded() + jobCondition: succeeded() + +stages: +- stage: msbuilddevice_tests + displayName: MSBuild Emulator Tests + dependsOn: mac_build + condition: ${{ parameters.stageCondition }} + jobs: + - job: ${{ parameters.job_name }} + strategy: + parallel: 4 + displayName: "macOS > Tests > MSBuild+Emulator $(System.JobPositionInPhase)" + condition: ${{ parameters.jobCondition }} + pool: + vmImage: $(HostedMacImage) + timeoutInMinutes: 90 + cancelTimeoutInMinutes: 5 + workspace: + clean: all + steps: + - template: setup-test-environment.yaml + parameters: + provisionClassic: false + provisionatorChannel: ${{ parameters.provisionatorChannel }} + + - template: run-xaprepare.yaml + parameters: + displayName: install emulator + arguments: --s=EmulatorTestDependencies + + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: $(TestAssembliesArtifactName) + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) + + - task: MSBuild@1 + displayName: start emulator + inputs: + solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj + configuration: $(XA.Build.Configuration) + msbuildArguments: /t:AcquireAndroidTarget /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/start-emulator.binlog + + - template: run-nunit-tests.yaml + parameters: + useDotNet: true + testRunTitle: MSBuildDeviceIntegration On Device - macOS-$(System.JobPositionInPhase) + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.dll + dotNetTestExtraArgs: --filter "TestCategory = Node-$(System.JobPositionInPhase) & TestCategory != TimeZoneInfo & TestCategory != Localization ${{ parameters.nunit_categories }}" + testResultsFile: TestResult-MSBuildDeviceIntegration-${{ parameters.job_name }}-$(System.JobPositionInPhase)-$(XA.Build.Configuration).xml + + - task: MSBuild@1 + displayName: shut down emulator + inputs: + solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj + configuration: $(XA.Build.Configuration) + msbuildArguments: >- + /t:AcquireAndroidTarget,ReleaseAndroidTarget + /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/shutdown-emulator.binlog + condition: always() + + - template: upload-results.yaml + parameters: + artifactName: Test Results - MSBuild With Emulator - macOS-$(System.JobPositionInPhase) + + - template: fail-on-issue.yaml From da5ca3a4ba9feaaaba51bb96a1e25f6edb4711ef Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Tue, 21 Feb 2023 09:36:16 -1000 Subject: [PATCH 2/5] Install dotnet-test-slicer. --- build-tools/automation/azure-pipelines.yaml | 1 + .../install-dotnet-test-slicer.yaml | 15 +++++++++++++++ .../yaml-templates/setup-test-environment.yaml | 2 ++ .../stage-msbuild-emulator-tests.yaml | 15 ++++++++++++--- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 build-tools/automation/yaml-templates/install-dotnet-test-slicer.yaml diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 961e10b6ad3..66f5f60cd49 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -657,6 +657,7 @@ stages: parameters: provisionatorChannel: ${{ parameters.provisionatorChannel }} stageCondition: and(succeeded(), or(eq(variables['RunAllTests'], true), contains(dependencies.mac_build.outputs['mac_build_create_installers.TestConditions.TestAreas'], 'MSBuildDevice'))) + nunit_categories: '& cat != DotNetIgnore & cat != HybridAOT & cat != MkBundle & cat != MonoSymbolicate & cat != PackagesConfig & cat != StaticProject & cat != SystemApplication' - job: wear_tests displayName: macOS > Tests > WearOS diff --git a/build-tools/automation/yaml-templates/install-dotnet-test-slicer.yaml b/build-tools/automation/yaml-templates/install-dotnet-test-slicer.yaml new file mode 100644 index 00000000000..0073fa34537 --- /dev/null +++ b/build-tools/automation/yaml-templates/install-dotnet-test-slicer.yaml @@ -0,0 +1,15 @@ +parameters: + version: '0.1.0-alpha1' + condition: succeeded() + continueOnError: true + +steps: +- powershell: dotnet tool uninstall dotnet-test-slicer -g + displayName: uninstall dotnet-test-slicer + ignoreLASTEXITCODE: true + condition: ${{ parameters.condition }} + +- script: dotnet tool update dotnet-test-slicer --version ${{ parameters.version }} --add-source https://api.nuget.org/v3/index.json -g + displayName: install dotnet-test-slicer ${{ parameters.version }} + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} diff --git a/build-tools/automation/yaml-templates/setup-test-environment.yaml b/build-tools/automation/yaml-templates/setup-test-environment.yaml index 727499dc2b6..ae5b8d3263c 100644 --- a/build-tools/automation/yaml-templates/setup-test-environment.yaml +++ b/build-tools/automation/yaml-templates/setup-test-environment.yaml @@ -101,3 +101,5 @@ steps: arguments: -t:ExtractWorkloadPacks -c ${{ parameters.configuration }} -v:n -bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/extract-workloads.binlog - template: install-apkdiff.yaml + +- template: install-dotnet-test-slicer.yaml diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index fa5003066d2..5ea1929e492 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -34,13 +34,22 @@ stages: - template: run-xaprepare.yaml parameters: displayName: install emulator - arguments: --s=EmulatorTestDependencies - + arguments: --s=EmulatorTestDependencies --android-sdk-platforms="19,21,26,32,33" + - task: DownloadPipelineArtifact@2 inputs: artifactName: $(TestAssembliesArtifactName) downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) + - pwsh: | + dotnet-test-slicer ` + --test-assembly="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.dll" ` + --test-filter="cat != TimeZoneInfo & cat != Localization ${{ parameters.nunit_categories }}" ` + --slice-number=$(System.JobPositionInPhase) ` + --total-slices=$(System.TotalJobsInPhase) ` + --outfile="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.runsettings" + displayName: Slice unit tests + - task: MSBuild@1 displayName: start emulator inputs: @@ -53,7 +62,7 @@ stages: useDotNet: true testRunTitle: MSBuildDeviceIntegration On Device - macOS-$(System.JobPositionInPhase) testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.dll - dotNetTestExtraArgs: --filter "TestCategory = Node-$(System.JobPositionInPhase) & TestCategory != TimeZoneInfo & TestCategory != Localization ${{ parameters.nunit_categories }}" + dotNetTestExtraArgs: --settings "$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.runsettings" testResultsFile: TestResult-MSBuildDeviceIntegration-${{ parameters.job_name }}-$(System.JobPositionInPhase)-$(XA.Build.Configuration).xml - task: MSBuild@1 From cd228bb31087dabcb5581ca24c611716edfafb8e Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Tue, 21 Feb 2023 13:57:34 -1000 Subject: [PATCH 3/5] =?UTF-8?q?=EF=BB=BFSwitch=20to=206=20agents.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/yaml-templates/setup-test-environment.yaml | 4 +++- .../yaml-templates/stage-msbuild-emulator-tests.yaml | 6 ++++-- tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs | 6 ++---- tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/InstallTests.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs | 2 +- .../MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs | 1 - .../Tests/SystemApplicationTests.cs | 2 +- .../Tests/UncaughtExceptionTests.cs | 2 +- tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs | 4 ++-- 15 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build-tools/automation/yaml-templates/setup-test-environment.yaml b/build-tools/automation/yaml-templates/setup-test-environment.yaml index ae5b8d3263c..63dbd94e598 100644 --- a/build-tools/automation/yaml-templates/setup-test-environment.yaml +++ b/build-tools/automation/yaml-templates/setup-test-environment.yaml @@ -7,6 +7,7 @@ parameters: updateVS: false jdkTestFolder: $(JAVA_HOME_11_X64) remove_dotnet: false + installTestSlicer: false steps: - checkout: self @@ -102,4 +103,5 @@ steps: - template: install-apkdiff.yaml -- template: install-dotnet-test-slicer.yaml +- ${{ if eq(parameters.installTestSlicer, true) }}: + - template: install-dotnet-test-slicer.yaml diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index 5ea1929e492..299cec531ca 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -2,6 +2,7 @@ parameters: job_name: 'mac_dotnetdevice_tests' + agent_count: 6 nunit_categories: $(DotNetNUnitCategories) target_framework: $(DotNetStableTargetFramework) provisionatorChannel: latest @@ -16,8 +17,8 @@ stages: jobs: - job: ${{ parameters.job_name }} strategy: - parallel: 4 - displayName: "macOS > Tests > MSBuild+Emulator $(System.JobPositionInPhase)" + parallel: ${{ parameters.agent_count }} + displayName: "macOS > Tests > MSBuild+Emulator" condition: ${{ parameters.jobCondition }} pool: vmImage: $(HostedMacImage) @@ -30,6 +31,7 @@ stages: parameters: provisionClassic: false provisionatorChannel: ${{ parameters.provisionatorChannel }} + installTestSlicer: true - template: run-xaprepare.yaml parameters: diff --git a/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs b/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs index 3ca51ac00a2..151ece0ba6c 100644 --- a/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs @@ -6,7 +6,7 @@ namespace Xamarin.Android.Build.Tests { - [Category ("UsesDevice"), Category ("AOT"), Category ("ProfiledAOT"), Category ("Node-3")] + [Category ("UsesDevice"), Category ("AOT"), Category ("ProfiledAOT")] public class AotProfileTests : DeviceTest { diff --git a/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs b/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs index 8242981e58e..1c94a4bc95a 100644 --- a/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs @@ -11,7 +11,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] [TestFixtureSource(nameof(FixtureArgs))] - [Category ("Node-1"), Category ("XamarinBuildDownload")] + [Category ("XamarinBuildDownload")] public class BundleToolTests : DeviceTest { static readonly object[] FixtureArgs = { diff --git a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs index 878cfdf6dcd..89afd11dae3 100755 --- a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs @@ -46,7 +46,6 @@ int FindTextInFile (string file, string text) } [Test] - [Category ("Node-3")] public void ApplicationRunsWithoutDebugger ([Values (false, true)] bool isRelease, [Values (false, true)] bool extractNativeLibs, [Values (false, true)] bool useEmbeddedDex) { AssertHasDevices (); @@ -84,7 +83,6 @@ public void ApplicationRunsWithoutDebugger ([Values (false, true)] bool isReleas } [Test] - [Category ("Node-3")] public void ClassLibraryMainLauncherRuns ([Values (true, false)] bool preloadAssemblies) { AssertHasDevices (); @@ -169,7 +167,7 @@ public void ClassLibraryMainLauncherRuns ([Values (true, false)] bool preloadAss }; #pragma warning restore 414 - [Test, Category ("Debugger"), Category ("Node-4")] + [Test, Category ("Debugger")] [TestCaseSource (nameof (DebuggerCustomAppTestCases))] [Retry(5)] public void CustomApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, string fastDevType, bool activityStarts) @@ -347,7 +345,7 @@ public override void OnCreate () }; #pragma warning restore 414 - [Test, Category ("SmokeTests"), Category ("Debugger"), Category ("Node-4")] + [Test, Category ("SmokeTests"), Category ("Debugger")] [TestCaseSource (nameof(DebuggerTestCases))] [Retry (5)] public void ApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, string fastDevType, bool allowDeltaInstall, string username, string debugType) diff --git a/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs b/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs index aeee3a0150d..85cecea4c96 100644 --- a/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs @@ -6,7 +6,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("DotNetIgnore"), Category ("Node-1")] // .csproj files are legacy projects that won't build under dotnet + [Category ("DotNetIgnore")] // .csproj files are legacy projects that won't build under dotnet public class DeleteBinObjTest : DeviceTest { const string BaseUrl = "https://github.com/dellis1972/xamarin-android-unittest-files/blob/main/"; diff --git a/tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs b/tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs index 688814fccf1..17e6982a6ea 100644 --- a/tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs @@ -20,7 +20,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("UsesDevice"), Category ("Node-2")] + [Category ("UsesDevice")] [NonParallelizable] public class DeploymentTest : DeviceTest { diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs index f1ab011b0ee..74054ded00c 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs @@ -8,7 +8,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("UsesDevice"), Category ("Node-2")] + [Category ("UsesDevice")] public class InstallAndRunTests : DeviceTest { static ProjectBuilder builder; diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs index 7161e21b5f2..582f5d0a1c1 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs @@ -12,7 +12,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("Commercial"), Category ("UsesDevice"), Category ("Node-1")] + [Category ("Commercial"), Category ("UsesDevice")] public class InstallTests : DeviceTest { string GetContentFromAllOverrideDirectories (string packageName, bool useRunAsCommand = true) diff --git a/tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs b/tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs index 6605cba3a8d..daeccc6d9aa 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs @@ -7,7 +7,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("Commercial"), Category ("UsesDevice"), Category ("Node-3")] + [Category ("Commercial"), Category ("UsesDevice")] public class InstantRunTest : DeviceTest { [Test] diff --git a/tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs b/tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs index 115c608077f..3b55b461388 100644 --- a/tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs @@ -12,7 +12,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("UsesDevice"), Category ("Node-1")] + [Category ("UsesDevice")] public class MonoAndroidExportTest : DeviceTest { #pragma warning disable 414 static object [] MonoAndroidExportTestCases = new object [] { diff --git a/tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs b/tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs index 4c4dea9ead0..e7e811eea17 100644 --- a/tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs @@ -11,7 +11,6 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("Node-2")] public class PerformanceTest : DeviceTest { const int Retry = 2; diff --git a/tests/MSBuildDeviceIntegration/Tests/SystemApplicationTests.cs b/tests/MSBuildDeviceIntegration/Tests/SystemApplicationTests.cs index aec87827786..63f4eeb5db5 100644 --- a/tests/MSBuildDeviceIntegration/Tests/SystemApplicationTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/SystemApplicationTests.cs @@ -11,7 +11,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("Commercial"), Category ("UsesDevice"), Category ("Node-1")] + [Category ("Commercial"), Category ("UsesDevice")] public class SystemApplicationTests : DeviceTest { // All Tests here require the emulator to be started with -writable-system diff --git a/tests/MSBuildDeviceIntegration/Tests/UncaughtExceptionTests.cs b/tests/MSBuildDeviceIntegration/Tests/UncaughtExceptionTests.cs index 167c60238d2..cbd646f55c8 100644 --- a/tests/MSBuildDeviceIntegration/Tests/UncaughtExceptionTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/UncaughtExceptionTests.cs @@ -8,7 +8,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("UsesDevice"), Category ("Node-3")] + [Category ("UsesDevice")] public class UncaughtExceptionTests : DeviceTest { class LogcatLine diff --git a/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs b/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs index aeb8ea6764d..ea14979cc75 100644 --- a/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs @@ -16,7 +16,7 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [Category ("UsesDevice"), Category ("SmokeTests"), Category ("WearOS"), Category ("Node-3")] + [Category ("UsesDevice"), Category ("SmokeTests"), Category ("WearOS")] public class XASdkDeployTests : DeviceTest { static object [] DotNetInstallAndRunSource = new object [] { @@ -209,7 +209,7 @@ public void SupportDesugaringStaticInterfaceMethods () } [Test] - [Category ("Debugger"), Category ("Node-4")] + [Category ("Debugger")] public void DotNetDebug ([Values("net6.0-android", "net7.0-android")] string targetFramework) { AssertCommercialBuild (); From 2ece1fbdcefaae109f94b8405edfe024018d1d4d Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Tue, 21 Feb 2023 20:30:22 -1000 Subject: [PATCH 4/5] =?UTF-8?q?=EF=BB=BFMove=20WearOS=20job=20to=20new=20s?= =?UTF-8?q?tage=20template.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-tools/automation/azure-pipelines.yaml | 68 ------------------ .../stage-msbuild-emulator-tests.yaml | 69 +++++++++++++++++++ 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 66f5f60cd49..33a502ee5af 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -659,74 +659,6 @@ stages: stageCondition: and(succeeded(), or(eq(variables['RunAllTests'], true), contains(dependencies.mac_build.outputs['mac_build_create_installers.TestConditions.TestAreas'], 'MSBuildDevice'))) nunit_categories: '& cat != DotNetIgnore & cat != HybridAOT & cat != MkBundle & cat != MonoSymbolicate & cat != PackagesConfig & cat != StaticProject & cat != SystemApplication' - - job: wear_tests - displayName: macOS > Tests > WearOS - timeoutInMinutes: 180 - cancelTimeoutInMinutes: 2 - strategy: - matrix: - Android30-x86: - avdApiLevel: 30 - avdAbi: x86 - avdType: android-wear - deviceName: wear_square - pool: - vmImage: $(HostedMacImage) - workspace: - clean: all - steps: - - template: yaml-templates/setup-test-environment.yaml - parameters: - configuration: $(XA.Build.Configuration) - - - template: yaml-templates/run-xaprepare.yaml - parameters: - displayName: install required brew tools and prepare java.interop - arguments: --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes - - - template: yaml-templates/run-xaprepare.yaml - parameters: - displayName: install emulator - arguments: --s=EmulatorTestDependencies - - - script: echo "##vso[task.setvariable variable=Java8SdkDirectory]$JAVA_HOME_8_X64" - displayName: set Java8SdkDirectory - - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: $(TestAssembliesArtifactName) - downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) - - - task: MSBuild@1 - displayName: install and launch emulator - inputs: - solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj - configuration: $(XA.Build.Configuration) - msbuildArguments: /t:InstallAvdImage;AcquireAndroidTarget /p:TestDeviceName=$(deviceName) /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType) /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/install-emulator-$(avdApiLevel).binlog - - - template: yaml-templates/run-nunit-tests.yaml - parameters: - testRunTitle: WearOS On Device - macOS - testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll - dotNetTestExtraArgs: --filter "TestCategory = WearOS" - testResultsFile: TestResult-WearOS--$(XA.Build.Configuration).xml - - - task: MSBuild@1 - displayName: shut down emulator - inputs: - solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj - configuration: $(XA.Build.Configuration) - msbuildArguments: /t:AcquireAndroidTarget,ReleaseAndroidTarget /p:TestDeviceName=$(deviceName) /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType) /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/shutdown-emulator.binlog - condition: always() - - - template: yaml-templates/upload-results.yaml - parameters: - configuration: $(XA.Build.Configuration) - artifactName: Test Results - Emulator $(avdApiLevel)-$(avdAbi)-$(avdType) - macOS - - - template: yaml-templates/fail-on-issue.yaml - - - stage: bcl_tests displayName: BCL Emulator Tests dependsOn: mac_build diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index 299cec531ca..20781bf7836 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -82,3 +82,72 @@ stages: artifactName: Test Results - MSBuild With Emulator - macOS-$(System.JobPositionInPhase) - template: fail-on-issue.yaml + + - job: wear_tests + displayName: macOS > Tests > WearOS + timeoutInMinutes: 180 + cancelTimeoutInMinutes: 2 + strategy: + matrix: + Android30-x86: + avdApiLevel: 30 + avdAbi: x86 + avdType: android-wear + deviceName: wear_square + pool: + vmImage: $(HostedMacImage) + workspace: + clean: all + steps: + - template: setup-test-environment.yaml + parameters: + configuration: $(XA.Build.Configuration) + + - template: run-xaprepare.yaml + parameters: + displayName: install required brew tools and prepare java.interop + arguments: --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes + + - template: run-xaprepare.yaml + parameters: + displayName: install emulator + arguments: --s=EmulatorTestDependencies + + - script: echo "##vso[task.setvariable variable=Java8SdkDirectory]$JAVA_HOME_8_X64" + displayName: set Java8SdkDirectory + + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: $(TestAssembliesArtifactName) + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) + + - task: MSBuild@1 + displayName: install and launch emulator + inputs: + solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj + configuration: $(XA.Build.Configuration) + msbuildArguments: /t:InstallAvdImage;AcquireAndroidTarget /p:TestDeviceName=$(deviceName) /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType) /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/install-emulator-$(avdApiLevel).binlog + + - template: run-nunit-tests.yaml + parameters: + useDotNet: true + testRunTitle: WearOS On Device - macOS + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll + dotNetTestExtraArgs: --filter "TestCategory = WearOS" + testResultsFile: TestResult-WearOS--$(XA.Build.Configuration).xml + + - task: MSBuild@1 + displayName: shut down emulator + inputs: + solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj + configuration: $(XA.Build.Configuration) + msbuildArguments: /t:AcquireAndroidTarget,ReleaseAndroidTarget /p:TestDeviceName=$(deviceName) /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType) /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/shutdown-emulator.binlog + condition: always() + + - template: upload-results.yaml + parameters: + configuration: $(XA.Build.Configuration) + artifactName: Test Results - Emulator $(avdApiLevel)-$(avdAbi)-$(avdType) - macOS + + - template: fail-on-issue.yaml + From d98dbd075826290336fd04294ef7447f6d204540 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Mon, 27 Feb 2023 11:32:52 -1000 Subject: [PATCH 5/5] Resolve merge conflict. --- .../automation/yaml-templates/stage-msbuild-emulator-tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index 20781bf7836..2438d9af305 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -130,7 +130,6 @@ stages: - template: run-nunit-tests.yaml parameters: - useDotNet: true testRunTitle: WearOS On Device - macOS testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll dotNetTestExtraArgs: --filter "TestCategory = WearOS"