Skip to content

Commit

Permalink
[mono] Revive FullAOT test lanes (#55362)
Browse files Browse the repository at this point in the history
We don't ship any products using FullAOT on Linux x64/arm64, but this
compilation mode is used for iOS, FullAOT-related issues that affect iOS are
likely to be caught by FullAOT on Linux x64/arm64, and it is a lot easier to
build, develop, and debug on desktop OSes.
  • Loading branch information
imhameed authored Sep 13, 2021
1 parent e62c4fe commit 19c5f54
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 30 deletions.
24 changes: 19 additions & 5 deletions eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ jobs:
# minijit and mono interpreter runtimevariants do not require any special build of the runtime
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, '', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if not(or(eq(parameters.runtimeVariant, 'minijit'), eq(parameters.runtimeVariant, 'monointerpreter'))) }}:
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if eq(parameters.runtimeVariant, 'llvmfullaot') }}:
- ${{ format('{0}_llvmaot_product_build_{1}{2}_{3}_{4}', parameters.runtimeFlavor, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if not(eq(parameters.runtimeVariant, 'llvmfullaot')) }}:
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}

Expand All @@ -84,6 +87,17 @@ jobs:

variables:

- name: monoAotBuildshCommand
value: ''

- ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}:
- name: monoAotBuildshCommand
value: 'mono_aot'

- ${{ if eq(parameters.runtimeVariant, 'llvmfullaot') }}:
- name: monoAotBuildshCommand
value: 'mono_fullaot'

- name: runtimeFlavorArgs
value: ''

Expand Down Expand Up @@ -293,7 +307,7 @@ jobs:
displayName: "Patch dotnet with mono"

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
- ${{ if and(eq(parameters.runtimeFlavor, 'mono'), eq(parameters.runtimeVariant, 'llvmaot')) }}:
- ${{ if and(eq(parameters.runtimeFlavor, 'mono'), or(eq(parameters.runtimeVariant, 'llvmaot'), eq(parameters.runtimeVariant, 'llvmfullaot'))) }}:
- ${{ if eq(parameters.archType, 'arm64') }}:
- script: ./build.sh
-subset mono
Expand All @@ -306,12 +320,12 @@ jobs:
/p:MonoAOTLLVMUseCxx11Abi=true
displayName: "Build Mono LLVM AOT cross compiler"

- ${{ if and(eq(parameters.runtimeFlavor, 'mono'), eq(parameters.runtimeVariant, 'llvmaot')) }}:
- ${{ if and(eq(parameters.runtimeFlavor, 'mono'), or(eq(parameters.runtimeVariant, 'llvmaot'), eq(parameters.runtimeVariant, 'llvmfullaot'))) }}:
- ${{ if eq(parameters.archType, 'x64') }}:
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) mono_aot $(buildConfig) $(archType) $(runtimeVariantArg)
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(monoAotBuildshCommand) $(buildConfig) $(archType) $(runtimeVariantArg)
displayName: "LLVM AOT compile CoreCLR tests"
- ${{ if eq(parameters.archType, 'arm64') }}:
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) mono_aot $(buildConfig) $(archType) cross $(runtimeVariantArg)
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(monoAotBuildshCommand) $(buildConfig) $(archType) cross $(runtimeVariantArg)
displayName: "LLVM AOT cross-compile CoreCLR tests"
env:
__MonoToolPrefix: aarch64-linux-gnu-
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/mono/templates/xplat-pipeline-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ jobs:
- name : buildProductArtifactName
value : 'MonoProduct___$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'

- ${{ if eq(parameters.runtimeVariant, 'llvmfullaot') }}:
- name : buildProductArtifactName
value : 'MonoProduct__llvmaot_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'

- name: binTestsPath
value: '$(Build.SourcesDirectory)/artifacts/tests/coreclr'

Expand Down
25 changes: 25 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,31 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Mono CoreCLR runtime Test executions using live libraries and LLVM Full AOT
# Only when Mono is changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: release
runtimeFlavor: mono
platforms:
- Linux_x64
- Linux_arm64
helixQueueGroup: pr
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
testGroup: innerloop
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
liveRuntimeBuildConfig: release
runtimeVariant: llvmfullaot
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Libraries Release Test Execution against a release mono runtime.
# Only when libraries or mono changed
Expand Down
13 changes: 12 additions & 1 deletion src/mono/msbuild/aot-compile.proj
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AotCompile">
<PropertyGroup>
<TestAssemblyDir>$([System.IO.Path]::GetDirectoryName($(_TestDll)))</TestAssemblyDir>
</PropertyGroup>
<ItemGroup>
<MonoEnvVar Condition="'$(_MonoPath)' != ''" Include="MONO_PATH=$(_MonoPath)" />
<MonoPathItem Include="$(TestAssemblyDir)" />
<MonoPathItem Include="$(_MonoPath)" Condition="'$(_MonoPath)' != ''" />
</ItemGroup>
<PropertyGroup>
<MonoPath>@(MonoPathItem->'%(Identity)', ':')</MonoPath>
</PropertyGroup>
<ItemGroup>
<MonoEnvVar Include="MONO_PATH=$(MonoPath)" />
<MonoEnvVar Include="MONO_ENV_OPTIONS=--aot=$(_MonoAotOptions)" />
</ItemGroup>
<Message Importance="High" Text="aot-compile: compiling $(_TestDll); MONO_PATH: $(MonoPath)" />
<Exec Command="$(_AotCompiler) $(_TestDll)" EnvironmentVariables="@(MonoEnvVar)" />
</Target>
</Project>
5 changes: 4 additions & 1 deletion src/tests/Common/testenvironment.proj
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,12 @@
<!-- Mono interpreter -->
<_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'monointerpreter'" Include="export MONO_ENV_OPTIONS=--interpreter" />

<!-- Hack: Use Mono LLVM JIT when JIT-compiling the non-AOT-compiled parts of the runtime tests -->
<!-- Use Mono LLVM JIT when JIT-compiling the non-AOT-compiled parts of the runtime tests -->
<_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'llvmaot'" Include="export MONO_ENV_OPTIONS=--llvm" />

<!-- Use Mono in Full AOT mode when running the full-AOT-compiled runtime tests -->
<_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'llvmfullaot'" Include="export MONO_ENV_OPTIONS=--full-aot" />

<!-- CLR interpreter -->
<_TestEnvFileLine Condition="'$(Scenario)' == 'clrinterpreter'" Include="export COMPlus_Interpret=%2A" /> <!-- %2A is asterisk / wildcard -->
<_TestEnvFileLine Condition="'$(Scenario)' == 'clrinterpreter'" Include="export COMPlus_InterpreterHWIntrinsicsIsSupportedFalse=1" />
Expand Down
18 changes: 14 additions & 4 deletions src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ build_test_wrappers()
build_mono_aot()
{
__RuntimeFlavor="mono"
__Exclude="$__RepoRootDir/src/tests/issues.targets"
__TestBinDir="$__TestWorkingDir"
__Exclude="$__RepoRootDir/src/tests/issues.targets"
CORE_ROOT="$__TestBinDir"/Tests/Core_Root
__MonoFullAotPropVal="false"
if [[ "$__MonoFullAot" -eq 1 ]]; then
__MonoFullAotPropVal="true"
fi
export __Exclude
export CORE_ROOT
build_MSBuild_projects "Tests_MonoAot" "$__RepoRootDir/src/tests/run.proj" "Mono AOT compile tests" "/t:MonoAotCompileTests" "/p:RuntimeFlavor=$__RuntimeFlavor" "/p:MonoBinDir=$__MonoBinDir"
build_MSBuild_projects "Tests_MonoAot" "$__RepoRootDir/src/tests/run.proj" "Mono AOT compile tests" "/t:MonoAotCompileTests" "/p:RuntimeFlavor=$__RuntimeFlavor" "/p:MonoBinDir=$__MonoBinDir" "/p:MonoFullAot=$__MonoFullAotPropVal"
}

build_ios_apps()
Expand Down Expand Up @@ -530,6 +534,11 @@ handle_arguments_local() {
__MonoAot=1
;;

mono_fullaot|-mono_fullaot)
__Mono=1
__MonoFullAot=1
;;

*)
__UnprocessedBuildArgs+=("$1")
;;
Expand Down Expand Up @@ -586,6 +595,7 @@ __CMakeArgs=""
__priority1=
__Mono=0
__MonoAot=0
__MonoFullAot=0
CORE_ROOT=

source $__RepoRootDir/src/coreclr/_build-commons.sh
Expand Down Expand Up @@ -638,11 +648,11 @@ if [[ "$__RebuildTests" -ne 0 ]]; then
fi
fi

if [[ (-z "$__GenerateLayoutOnly") && (-z "$__BuildTestWrappersOnly") && ("$__MonoAot" -eq 0) ]]; then
if [[ (-z "$__GenerateLayoutOnly") && (-z "$__BuildTestWrappersOnly") && ("$__MonoAot" -eq 0) && ("$__MonoFullAot" -eq 0) ]]; then
build_Tests
elif [[ ! -z "$__BuildTestWrappersOnly" ]]; then
build_test_wrappers
elif [[ "$__MonoAot" -eq 1 ]]; then
elif [[ ("$__MonoAot" -eq 1) || ("$__MonoFullAot" -eq 1) ]]; then
build_mono_aot
else
generate_layout
Expand Down
Loading

0 comments on commit 19c5f54

Please sign in to comment.