Skip to content

Run tests under CoreCLR #9863

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

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
582c449
Enable the test
grendello Feb 28, 2025
249e3bf
Let's see if I got it right :D
grendello Feb 28, 2025
6ca1c64
Fix typos
grendello Feb 28, 2025
9d47610
Fix number two
grendello Feb 28, 2025
f3942de
Fix three
grendello Feb 28, 2025
ed36b39
Let's see how this works
grendello Mar 4, 2025
4c45845
How about this then
grendello Mar 4, 2025
3ddedf3
Let's see what, if anything, is fixed by this
grendello Mar 5, 2025
b0e94e4
Try to prevent the SetupOSSpecificPropertyes from running when not ne…
grendello Mar 6, 2025
084b8f9
Does this change anything?
grendello Mar 6, 2025
ecd5750
Tweaks
grendello Mar 6, 2025
06cacd2
Fix locations of native *.include files
grendello Mar 7, 2025
6f9a9e8
Update CoreCLR packages in the workload manifest
grendello Mar 7, 2025
8affe10
Use `android-arm64`, since it's supported by all the runtimes
grendello Mar 10, 2025
f60897c
CoreCLR doesn't support all RIDs
grendello Mar 10, 2025
c2c1d3f
Switch to `arm64-v8a`, because all runtimes support it
grendello Mar 10, 2025
b56172c
Interpreter isn't supported by CoreCLR
grendello Mar 10, 2025
a5d0e7a
Ignore test for unsupported ABIs
grendello Mar 10, 2025
dca71b5
CoreCLR doesn't support 32-bit ABIs
grendello Mar 10, 2025
e92fd83
CoreCLR doesn't support MonoVM-style AOT
grendello Mar 10, 2025
b60c4b6
Use only 64-bit ABIs
grendello Mar 10, 2025
0acd0b8
Don't do that, we will ignore the entire category eventually
grendello Mar 10, 2025
8d2a1df
Switch more tests to 64-bit ABIs
grendello Mar 10, 2025
97181d6
Let's see what this changes
grendello Mar 11, 2025
5b60d1a
Address feedback
grendello Mar 10, 2025
1365db4
Address feedback
grendello Mar 11, 2025
31c4f16
Hopefully fix a handful of tests
grendello Mar 11, 2025
7e5e57a
Another portion of fixes, hopefully
grendello Mar 11, 2025
c3d9f06
Fix artifact names + some more test fixes
grendello Mar 12, 2025
9a1a2c0
More fixes and fixlets
grendello Mar 12, 2025
55ed1a0
A few more steps forward
grendello Mar 13, 2025
95fd095
Let's see again...
grendello Mar 13, 2025
98fee59
This causes too many problems, alas
grendello Mar 13, 2025
fa0e7aa
Let's try to see what's going on there...
grendello Mar 17, 2025
ff7bdd5
A bit more printf debugging
grendello Mar 17, 2025
29b0f38
Let's see if this fixes DotNetPublish for API 35 on CoreCLR
grendello Mar 17, 2025
7150188
MonoVM vs CoreCLR ApplicationConfig
grendello Mar 17, 2025
241866d
Maybe that works?
grendello Mar 18, 2025
88cecfa
Fix after rebase
grendello Mar 25, 2025
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
19 changes: 19 additions & 0 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,31 @@ extends:
macTestAgentsUseCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}

- template: /build-tools/automation/yaml-templates/stage-linux-tests.yaml@self
parameters:
runtimeName: "MonoVM"

- template: /build-tools/automation/yaml-templates/stage-msbuild-tests.yaml@self
parameters:
runtimeName: "MonoVM"

- template: /build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml@self
parameters:
usesCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}
runtimeName: "MonoVM"

- template: /build-tools/automation/yaml-templates/stage-linux-tests.yaml@self
parameters:
runtimeName: "CoreCLR"

- template: /build-tools/automation/yaml-templates/stage-msbuild-tests.yaml@self
parameters:
runtimeName: "CoreCLR"
testFilter: $(CoreCLRExcludedNunitCategories)

- template: /build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml@self
parameters:
usesCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}
runtimeName: "CoreCLR"

- stage: maui_tests
displayName: MAUI Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
testOS: '' # 'macOS' or 'Windows'
runtimeName: '' # MonoVM or CoreCLR
jobName: '' # Name of the job
jobDisplayName: '' # Display name of the job
agentCount: 1 # Number of build agents to run in parallel
Expand Down Expand Up @@ -42,6 +43,10 @@ jobs:
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}

- template: /build-tools/automation/yaml-templates/select-test-runtime.yaml
parameters:
runtimeName: ${{ parameters.runtimeName }}

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
Expand All @@ -51,13 +56,13 @@ jobs:
parameters:
testAssembly: ${{ parameters.xaSourcePath }}/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
testFilter: ${{ parameters.testFilter }}
testRunTitle: Xamarin.Android.Build.Tests - ${{ parameters.testOS }}
testRunTitle: Xamarin.Android.Build.Tests - ${{ parameters.testOS }} (${{ parameters.runtimeName }})
retryFailedTests: false
xaSourcePath: ${{ parameters.xaSourcePath }}

- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
artifactName: Test Results - MSBuild - ${{ parameters.testOS }}-$(System.JobPositionInPhase)
artifactName: Test Results - MSBuild - ${{ parameters.testOS }}-${{ parameters.runtimeName }}-$(System.JobPositionInPhase)
xaSourcePath: ${{ parameters.xaSourcePath }}
use1ESTemplate: ${{ parameters.use1ESTemplate }}

Expand Down
14 changes: 14 additions & 0 deletions build-tools/automation/yaml-templates/select-test-runtime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
parameters:
runtimeName: ''

steps:
- pwsh: |
Write-Host "Selecting target runtime: "${{ parameters.runtimeName }}""
if ("${{ parameters.runtimeName }}" -eq "CoreCLR") {
$useMonoRuntime="false"
} else {
$useMonoRuntime="true"
}

Write-Host "##vso[task.setvariable variable=USE_MONO_RUNTIME]$useMonoRuntime"
displayName: select target runtime (MonoVM or CoreCLR)
30 changes: 20 additions & 10 deletions build-tools/automation/yaml-templates/stage-linux-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Runs smoke tests on Linux packages.
parameters:
runtimeName: ''

stages:
- stage: linux_tests
displayName: Linux Tests
- stage: linux_tests_${{ parameters.runtimeName }}
displayName: Linux Tests (${{ parameters.runtimeName }})
dependsOn:
- mac_build
- linux_build
jobs:
# Check - "Xamarin.Android (Linux Tests Linux > Tests > MSBuild)"
- job: linux_tests_smoke_1
displayName: Linux > Tests > MSBuild 1
displayName: Linux > Tests > MSBuild 1 (${{ parameters.runtimeName }})
pool:
name: MAUI-1ESPT
image: $(LinuxPoolImage1ESPT)
Expand All @@ -20,26 +22,30 @@ stages:
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml

- template: /build-tools/automation/yaml-templates/select-test-runtime.yaml
parameters:
runtimeName: ${{ parameters.runtimeName }}

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux BuildTest
testRunTitle: Xamarin.Android.Build.Tests - Linux BuildTest (${{ parameters.runtimeName }})
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = BuildTest"

- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
configuration: $(XA.Build.Configuration)
artifactName: Test Results - MSBuild - Linux 1
artifactName: Test Results - MSBuild - Linux 1 - ${{ parameters.runtimeName }}

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml

- job: linux_tests_smoke_2
displayName: Linux > Tests > MSBuild 2
displayName: Linux > Tests > MSBuild 2 (${{ parameters.runtimeName }})
pool:
name: MAUI-1ESPT
image: $(LinuxPoolImage1ESPT)
Expand All @@ -50,26 +56,30 @@ stages:
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml

- template: /build-tools/automation/yaml-templates/select-test-runtime.yaml
parameters:
runtimeName: ${{ parameters.runtimeName }}

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux PackagingTest
testRunTitle: Xamarin.Android.Build.Tests - Linux PackagingTest (${{ parameters.runtimeName }})
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = PackagingTest"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux XASdkTests
testRunTitle: Xamarin.Android.Build.Tests - Linux XASdkTests (${{ parameters.runtimeName }})
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = XASdkTests & Name != XamarinLegacySdk"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux AndroidDependenciesTests
testRunTitle: Xamarin.Android.Build.Tests - Linux AndroidDependenciesTests (${{ parameters.runtimeName }})
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = AndroidDependenciesTests"

Expand All @@ -82,6 +92,6 @@ stages:
- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
configuration: $(XA.Build.Configuration)
artifactName: Test Results - MSBuild - Linux 2
artifactName: Test Results - MSBuild - Linux 2 - ${{ parameters.runtimeName }}

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Runs MSBuild tests against a device running on macOS

parameters:
runtimeName: ''
stageName: msbuilddevice_tests
job_name: 'mac_dotnetdevice_tests'
dependsOn: mac_build
Expand All @@ -16,8 +17,8 @@ parameters:
use1ESTemplate: true

stages:
- stage: ${{ parameters.stageName }}
displayName: ${{ parameters.stagePrefix }}MSBuild Emulator Tests
- stage: ${{ parameters.stageName }}_${{ parameters.runtimeName }}
displayName: ${{ parameters.stagePrefix }}MSBuild Emulator Tests (${{ parameters.runtimeName }})
dependsOn: ${{ parameters.dependsOn }}
condition: ${{ parameters.stageCondition }}
jobs:
Expand All @@ -44,6 +45,10 @@ stages:
commit: ${{ parameters.commit }}
xaprepareScenario: EmulatorTestDependencies

- template: /build-tools/automation/yaml-templates/select-test-runtime.yaml
parameters:
runtimeName: ${{ parameters.runtimeName }}

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
Expand Down Expand Up @@ -85,7 +90,7 @@ stages:
condition: ${{ parameters.shouldFailOnIssue }}

- job: wear_tests
displayName: macOS > Tests > WearOS
displayName: macOS > Tests > WearOS (${{ parameters.runtimeName }})
timeoutInMinutes: 180
cancelTimeoutInMinutes: 2
strategy:
Expand All @@ -111,6 +116,10 @@ stages:
commit: ${{ parameters.commit }}
xaprepareScenario: EmulatorTestDependencies

- template: /build-tools/automation/yaml-templates/select-test-runtime.yaml
parameters:
runtimeName: ${{ parameters.runtimeName }}

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
Expand Down
10 changes: 8 additions & 2 deletions build-tools/automation/yaml-templates/stage-msbuild-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Runs MSBuild tests that do not require devices on Mac/Windows

parameters:
runtimeName: ''
testFilter: '' # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
stageName: msbuild_dotnet
stageCondition: succeeded()
dependsOn: mac_build
Expand All @@ -12,14 +14,16 @@ parameters:
use1ESTemplate: true

stages:
- stage: ${{ parameters.stageName }}
displayName: ${{ parameters.stagePrefix }}MSBuild Tests
- stage: ${{ parameters.stageName }}_${{ parameters.runtimeName }}
displayName: ${{ parameters.stagePrefix }}MSBuild Tests (${{ parameters.runtimeName }})
dependsOn: ${{ parameters.dependsOn }}
condition: ${{ parameters.stageCondition }}
jobs:
- template: /build-tools/automation/yaml-templates/run-msbuild-tests.yaml
parameters:
testOS: macOS
runtimeName: ${{ parameters.runtimeName }}
testFilter: ${{ parameters.testFilter }}
jobName: mac_msbuild_tests
jobDisplayName: macOS > Tests > MSBuild
agentCount: 10
Expand All @@ -32,6 +36,8 @@ stages:
- template: /build-tools/automation/yaml-templates/run-msbuild-tests.yaml
parameters:
testOS: Windows
runtimeName: ${{ parameters.runtimeName }}
testFilter: ${{ parameters.testFilter }}
jobName: win_msbuild_tests
jobDisplayName: Windows > Tests > MSBuild
agentCount: 8
Expand Down
2 changes: 2 additions & 0 deletions build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ variables:
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
- name: RunMAUITestJob
value: true
- name: CoreCLRExcludedNunitCategories
value: 'cat != AOT'
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<!-- HACK: make dotnet restore include Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64 -->
<_IsPublishing Condition=" '$(_IsPublishing)' == '' and '$(_AndroidRuntime)' == 'NativeAOT' ">true</_IsPublishing>

<!-- HACK: NativeCompilationDuringPublish is set to `true` by Microsoft.NETCore.Native.targets
by default, which enforces running of the SetupOSSpecificProps target which, if NDK is
present or its bin directory isn't in PATH, will error out not being able to find
llvm-objcopy or objcopy even though the current build doesn't need them because it doesn't
target NativeAOT. Setting it here will hopefully prevent that from happening. -->
<NativeCompilationDuringPublish Condition=" '$(NativeCompilationDuringPublish)' == '' And '$(_AndroidRuntime)' != 'NativeAOT' ">false</NativeCompilationDuringPublish>

<!-- Use $(AndroidMinimumSupportedApiLevel) for $(SupportedOSPlatformVersion) if unset -->
<SupportedOSPlatformVersion Condition=" '$(SupportedOSPlatformVersion)' == '' ">$(AndroidMinimumSupportedApiLevel)</SupportedOSPlatformVersion>
<!-- $(SupportedOSPlatformVersion) must be '21.0', but we should support integer values like '21' -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"packs": [
"Microsoft.Android.Sdk.net10",
"Microsoft.Android.Sdk.net9",
"Microsoft.Android.Ref.36",
"Microsoft.Android.Runtime.Mono.36.android-arm",
"Microsoft.Android.Runtime.Mono.36.android-arm64",
"Microsoft.Android.Runtime.Mono.36.android-x86",
"Microsoft.Android.Runtime.Mono.36.android-x64",
"Microsoft.Android.Ref.35",
"Microsoft.Android.Runtime.Mono.35.android-arm",
"Microsoft.Android.Runtime.Mono.35.android-arm64",
"Microsoft.Android.Runtime.Mono.35.android-x86",
"Microsoft.Android.Runtime.Mono.35.android-x64",
"Microsoft.Android.Runtime.CoreCLR.35.android-arm64",
"Microsoft.Android.Runtime.CoreCLR.35.android-x64",
"Microsoft.Android.Templates"
],
"platforms": [ "win-x64", "win-arm64", "linux-x64", "linux-arm64", "osx-x64", "osx-arm64" ],
Expand Down
Loading
Loading