Skip to content

Commit 7531c50

Browse files
authored
[mono][tests] Parallel AOT compilation of runtime tests on iOS platforms (#86089)
The Helix payload is generated using the runtime pipeline. Then, the libraries pipeline is utilized to AOT compile and execute the tests on Helix. The build-runtime-tests-and-send-to-helix.yml is updated with the compileOnHelix parameter, which if set, uses the libraries/helix.yml template instead of the runtime send-to-helix-step.yml template. The runtime and libraries pipelines are updated to support AOT compilation of runtime tests on Helix.
1 parent f016dc4 commit 7531c50

12 files changed

+225
-205
lines changed

eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ parameters:
2727
enableMicrobuild: ''
2828
gatherAssetManifests: false
2929
shouldContinueOnError: false
30+
compileOnHelix: false
31+
interpreter: false
3032

3133
steps:
3234
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests.yml
@@ -72,49 +74,64 @@ steps:
7274
env:
7375
__MonoToolPrefix: aarch64-linux-gnu-
7476

75-
# Send tests to Helix
76-
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
77-
parameters:
78-
displayName: Send tests to Helix
79-
buildConfig: $(buildConfigUpper)
80-
archType: ${{ parameters.archType }}
81-
osGroup: ${{ parameters.osGroup }}
82-
osSubgroup: ${{ parameters.osSubgroup}}
83-
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
84-
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
85-
runtimeFlavor: ${{ parameters.runtimeFlavor }}
86-
runtimeVariant: ${{ parameters.runtimeVariant }}
77+
# Checks the value of the compileOnHelix parameter
78+
# and if set invokes libraries pipeline for AOT on Helix
79+
- ${{ if eq(parameters.compileOnHelix, 'true') }}:
80+
- template: /eng/pipelines/libraries/helix.yml
81+
parameters:
82+
osGroup: ${{ parameters.osGroup }}
83+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
84+
archType: ${{ parameters.archType }}
85+
targetRid: ${{ parameters.targetRid }}
86+
buildConfig: ${{ parameters.buildConfig }}
87+
interpreter: ${{ parameters.interpreter }}
88+
testRunNamePrefixSuffix: ${{ parameters.testRunNamePrefixSuffix }}
89+
extraHelixArguments: ${{ parameters.extraHelixArguments }}
90+
helixQueues: ${{ parameters.helixQueues }}
91+
creator: ${{ parameters.creator }}
92+
- ${{ else }}:
93+
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
94+
parameters:
95+
displayName: Send tests to Helix
96+
buildConfig: $(buildConfigUpper)
97+
archType: ${{ parameters.archType }}
98+
osGroup: ${{ parameters.osGroup }}
99+
osSubgroup: ${{ parameters.osSubgroup}}
100+
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
101+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
102+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
103+
runtimeVariant: ${{ parameters.runtimeVariant }}
87104

88-
${{ if eq(variables['System.TeamProject'], 'public') }}:
89-
creator: $(Build.DefinitionName)
105+
${{ if eq(variables['System.TeamProject'], 'public') }}:
106+
creator: $(Build.DefinitionName)
90107

91-
helixBuild: $(Build.BuildNumber)
92-
helixSource: $(_HelixSource)
108+
helixBuild: $(Build.BuildNumber)
109+
helixSource: $(_HelixSource)
93110

94-
${{ if ne(parameters.readyToRun, true) }}:
95-
helixType: 'test/functional/cli/'
111+
${{ if ne(parameters.readyToRun, true) }}:
112+
helixType: 'test/functional/cli/'
96113

97-
helixQueues: ${{ parameters.helixQueues }}
114+
helixQueues: ${{ parameters.helixQueues }}
98115

99-
# This tests whether an array is empty
100-
${{ if eq(join('', parameters.helixQueues), '') }}:
101-
condition: false
116+
# This tests whether an array is empty
117+
${{ if eq(join('', parameters.helixQueues), '') }}:
118+
condition: false
102119

103-
publishTestResults: true
120+
publishTestResults: true
104121

105-
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
106-
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)
122+
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
123+
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)
107124

108-
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
109-
compositeBuildMode: ${{ parameters.compositeBuildMode }}
110-
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
111-
nativeAotTest: ${{ parameters.nativeAotTest }}
125+
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
126+
compositeBuildMode: ${{ parameters.compositeBuildMode }}
127+
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
128+
nativeAotTest: ${{ parameters.nativeAotTest }}
112129

113-
${{ if eq(variables['System.TeamProject'], 'internal') }}:
114-
# Access token variable for internal project from the
115-
# DotNet-HelixApi-Access variable group
116-
helixAccessToken: $(HelixApiAccessToken)
130+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
131+
# Access token variable for internal project from the
132+
# DotNet-HelixApi-Access variable group
133+
helixAccessToken: $(HelixApiAccessToken)
117134

118-
helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
135+
helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
119136

120-
scenarios: ${{ parameters.scenarios }}
137+
scenarios: ${{ parameters.scenarios }}

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
4646

4747
#
48-
# Build the whole product using Mono for iOS/tvOS and run runtime tests with iOS/tvOS devices
48+
# iOS/tvOS devices
49+
# Build the whole product using Mono and run runtime tests
4950
#
5051
- template: /eng/pipelines/common/platform-matrix.yml
5152
parameters:
@@ -82,9 +83,11 @@ jobs:
8283
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
8384
extraStepsParameters:
8485
creator: dotnet-bot
85-
# FIXME: Currently, tracing/eventpipe tests are only enabled on iOS platforms. It should be expanded to include all runtime tests. Tracking issue: https://github.com/dotnet/runtime/issues/84254
86-
testBuildArgs: tree tracing/eventpipe
86+
compileOnHelix: true
87+
interpreter: true
88+
testBuildArgs: /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true
8789
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
90+
extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
8891

8992
#
9093
# Build the whole product using NativeAOT for iOS/tvOS and run runtime tests with iOS/tvOS devices

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ jobs:
8585
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
8686
extraStepsParameters:
8787
creator: dotnet-bot
88-
# FIXME: Currently, tracing/eventpipe tests are only enabled on iOS platforms. It should be expanded to include all runtime tests. Tracking issue: https://github.com/dotnet/runtime/issues/84254
89-
testBuildArgs: tree tracing/eventpipe
88+
compileOnHelix: true
89+
interpreter: true
90+
testBuildArgs: /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true
9091
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
92+
extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
9193

9294
#
9395
# Build the whole product using Native AOT for iOSSimulator/tvOSSimulator and run runtime tests with iOS/tvOS simulators

eng/testing/tests.ioslike.targets

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
<_AOTBuildCommand>$(_AOTBuildCommand) </_AOTBuildCommand>
2121

2222
<_ResetSimulatorSwitch Condition="'$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator'">--reset-simulator</_ResetSimulatorSwitch>
23-
<_SignalAppEndSwitch Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos'">--signal-app-end</_SignalAppEndSwitch>
23+
<_SignalAppEndSwitch>--signal-app-end</_SignalAppEndSwitch>
24+
<_AppleSignCommand Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos'">sign &quot;$app&quot;</_AppleSignCommand>
2425

2526
<_AfterBuildCommands>
2627
mv $XHARNESS_OUT/AOTBuild.binlog &quot;$HELIX_WORKITEM_UPLOAD_ROOT&quot;
27-
sign &quot;$app&quot;
28+
$(_AppleSignCommand)
2829
xharness apple test --app &quot;$app&quot; --output-directory &quot;$output_directory&quot; --target &quot;$target&quot; --timeout &quot;$timeout&quot; --xcode &quot;$xcode_path&quot; -v --launch-timeout &quot;$launch_timeout&quot; $(_ResetSimulatorSwitch) $(_SignalAppEndSwitch) -- </_AfterBuildCommands>
2930

3031
<RunScriptCommand>$(_AOTBuildCommand) $(_AfterBuildCommands)</RunScriptCommand>
@@ -61,14 +62,21 @@
6162
</PropertyGroup>
6263

6364
<ItemGroup>
64-
<BundleFiles Condition="'%(AppleAssembliesToBundle._IsNative)' != 'true'"
65-
Include="@(AppleAssembliesToBundle)" TargetDir="publish\%(AppleAssembliesToBundle.RecursiveDir)" />
66-
<BundleFiles Include="@(AppleNativeFilesToBundle)" TargetDir="publish\%(AppleNativeFilesToBundle.RecursiveDir)" />
67-
<BundleFiles Include="$(RuntimeConfigFilePath)" TargetDir="publish" />
65+
<!--
66+
Checks if the directory name "AppleAssembliesToBundle" is equal to the "AssemblyName",
67+
if they match, consider it as the root directory and copy the files there,
68+
otherwise, copy the files to a subdirectory.
69+
-->
70+
<BundleFiles Condition="'%(AppleAssembliesToBundle._IsNative)' != 'true' and ($([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('%(AppleAssembliesToBundle.Identity)')))) == '$(AssemblyName)' or '$(IsRuntimeTests)' != 'true')"
71+
Include="@(AppleAssembliesToBundle)" TargetDir="publish" />
72+
<BundleFiles Condition="'%(AppleAssembliesToBundle._IsNative)' != 'true' and $([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('%(AppleAssembliesToBundle.Identity)')))) != '$(AssemblyName)' and '$(IsRuntimeTests)' == 'true'"
73+
Include="@(AppleAssembliesToBundle)" TargetDir="publish\$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('%(AppleAssembliesToBundle.Identity)'))))" />
74+
75+
<BundleFiles Include="@(AppleNativeFilesToBundle)" TargetDir="publish" />
6876

69-
<BundleFiles Include="$(MonoProjectRoot)\msbuild\apple\data\*" TargetDir="publish" />
77+
<BundleFiles Include="$(MonoProjectRoot)\msbuild\apple\data\*" TargetDir="publish" />
7078
<ExtraFiles Condition="'%(AppleAssembliesToBundle._IsNative)' == 'true'"
71-
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" />
79+
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles" />
7280
</ItemGroup>
7381

7482
<ItemGroup Condition="'$(DebuggerSupport)' == 'true'">
@@ -103,6 +111,8 @@
103111
<_ApplePropertyNames Include="HybridGlobalization" />
104112
<_ApplePropertyNames Include="AssemblyName" />
105113
<_ApplePropertyNames Include="MonoEnableLLVM" />
114+
<_ApplePropertyNames Include="UseRuntimeComponents" />
115+
<_ApplePropertyNames Include="IsRuntimeTests" />
106116

107117
<_ApplePropertiesToPass
108118
Include="$(%(_ApplePropertyNames.Identity))"
@@ -137,7 +147,7 @@
137147

138148
<PropertyGroup>
139149
<Optimized Condition="'$(Configuration)' == 'Release'">true</Optimized>
140-
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == ''">AppleTestRunner.dll</MainLibraryFileName>
150+
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == '' and '$(IsRuntimeTests)' != 'true'">AppleTestRunner.dll</MainLibraryFileName>
141151

142152
<AppleBuildDir>$(PublishDir)</AppleBuildDir>
143153
<AppleBundleDir>$(BundleDir)</AppleBundleDir>

eng/testing/tests.mobile.targets

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
<RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath>
99

1010
<PublishingTestsRun>true</PublishingTestsRun>
11-
<PublishTestAsSelfContainedDependsOn>Publish</PublishTestAsSelfContainedDependsOn>
11+
<PublishTestAsSelfContainedDependsOn Condition="'$(PublishTestAsSelfContainedDependsOn)' == ''">Publish</PublishTestAsSelfContainedDependsOn>
12+
<PublishTestAsSelfContainedAfterTargets Condition="'$(PublishTestAsSelfContainedAfterTargets)' == ''">Build</PublishTestAsSelfContainedAfterTargets>
1213

1314
<SkipWorkloadsTestingTargetsImport Condition="'$(SkipWorkloadsTestingTargetsImport)' == ''">true</SkipWorkloadsTestingTargetsImport>
1415
</PropertyGroup>
@@ -155,7 +156,7 @@
155156

156157
<Target Name="PublishTestAsSelfContained"
157158
Condition="'$(IsCrossTargetingBuild)' != 'true'"
158-
AfterTargets="Build"
159+
AfterTargets="$(PublishTestAsSelfContainedAfterTargets)"
159160
DependsOnTargets="$(PublishTestAsSelfContainedDependsOn);$(BundleTestAppTargets);ArchiveTests" />
160161

161162
<Target Name="PrepareForTestUsingWorkloads"

eng/testing/tests.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@
127127
<RunScriptCommands Include="@(PostRunScriptCommands)" />
128128
</ItemGroup>
129129

130+
<PropertyGroup Condition="'$(RunScriptOutputDirectory)' != ''">
131+
<RunScriptOutputPath>$([MSBuild]::NormalizePath('$(RunScriptOutputDirectory)', '$(RunScriptOutputName)'))</RunScriptOutputPath>
132+
</PropertyGroup>
133+
130134
<GenerateRunScript RunCommands="@(RunScriptCommands)"
131135
SetCommands="@(SetScriptCommands)"
132136
TemplatePath="$(RunScriptInputPath)"

src/mono/msbuild/apple/build/AppleBuild.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<!-- iOS/tvOS device + arm64 simulators need to AOT -->
33
<PropertyGroup Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or (('$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator') And '$(TargetArchitecture)' == 'arm64')">
44
<RunAOTCompilation Condition="'$(RunAOTCompilation)' == ''">true</RunAOTCompilation>
5-
<iOSLikeDedup Condition="'$(iOSLikeDedup)' == ''">true</iOSLikeDedup>
65
</PropertyGroup>
76

87
<!-- iOS/tvOS arm64 simulators do not support JIT, so force interpreter fallback, devices should FullAOT -->
@@ -11,6 +10,7 @@
1110
</PropertyGroup>
1211

1312
<PropertyGroup>
13+
<iOSLikeDedup Condition="'$(iOSLikeDedup)' == '' and '$(RunAOTCompilation)' == 'true' and '$(MonoForceInterpreter)' != 'true'">true</iOSLikeDedup>
1414
<RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())</RuntimeIdentifier>
1515
<UseMonoRuntime>true</UseMonoRuntime>
1616
<UseMonoJustInterp Condition="'$(RunAOTCompilation)' == 'true' and '$(MonoForceInterpreter)' == 'true'">true</UseMonoJustInterp>

src/mono/msbuild/apple/build/AppleBuild.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@
155155

156156
<ItemGroup>
157157
<_AotExcludeAssemblies Include="*System.Runtime.WindowsRuntime.dll" />
158+
<_AssembliesToBundleInternal>
159+
<_InternalForceInterpret Condition="'$(MonoForceInterpreter)' == 'true' and '%(FileName)%(Extension)' != 'System.Private.CoreLib.dll'">true</_InternalForceInterpret>
160+
<_IsNative>false</_IsNative>
161+
</_AssembliesToBundleInternal>
158162

159163
<_AotInputAssemblies Include="@(_AssembliesToBundleInternal)"
160164
Condition="'%(_AssembliesToBundleInternal._InternalForceInterpret)' != 'true'">

src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@
2929
<AppleBuildDir>$(OriginalPublishDir)</AppleBuildDir>
3030
<AppleBundleDir>$(TestRootDir)AppBundle\</AppleBundleDir>
3131

32-
<MainLibraryFileName>$(OriginalPublishDir)AppleTestRunner.dll</MainLibraryFileName>
32+
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == '' and '$(IsRuntimeTests)' != 'true'">$(OriginalPublishDir)AppleTestRunner.dll</MainLibraryFileName>
3333
<Optimized Condition="'$(Configuration)' != 'Debug'">true</Optimized>
3434
</PropertyGroup>
3535

36+
<PropertyGroup Condition="'$(UseRuntimeComponents)' == 'true'">
37+
<RuntimeComponents>diagnostics_tracing;marshal-ilgen</RuntimeComponents>
38+
<DiagnosticPorts>127.0.0.1:9000,nosuspend,listen</DiagnosticPorts>
39+
</PropertyGroup>
40+
3641
<ItemGroup>
3742
<!-- Figure out if we can support JustInterp mode -->
3843
<AppleAssembliesToBundle Include="$(OriginalPublishDir)**\*.dll" Exclude="$(OriginalPublishDir)\**\*.resources.dll" />

src/tests/Directory.Build.targets

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@
99
<Import Project="$(MSBuildThisFileDirectory)/Common/disableversioncheck.targets"
1010
Condition="'$(DisableVersionCheckImported)' != 'true'" />
1111

12+
<PropertyGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono'">
13+
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
14+
<TestArchiveRoot>$(ArtifactsDir)helix/</TestArchiveRoot>
15+
<TestArchiveTestsRoot>$(TestArchiveRoot)tests/</TestArchiveTestsRoot>
16+
<TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
17+
<TestArchiveRuntimeRoot>$(TestArchiveRoot)runtime/</TestArchiveRuntimeRoot>
18+
19+
<PublishTestAsSelfContainedDependsOn>BuildMonoiOSApp</PublishTestAsSelfContainedDependsOn>
20+
<PublishTestAsSelfContainedAfterTargets>BuildMonoiOSApp</PublishTestAsSelfContainedAfterTargets>
21+
<BundleTestAppleAppDependsOn>GenerateRunScript</BundleTestAppleAppDependsOn>
22+
23+
<IsRuntimeTests>true</IsRuntimeTests>
24+
</PropertyGroup>
25+
26+
<Import Project="$(RepositoryEngineeringDir)testing\tests.targets"
27+
Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono'" />
28+
29+
<Target Name="_SetRunScriptOutputDirectory" Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono' and '$(IsRuntimeTests)' == 'true'" BeforeTargets="GenerateRunScript">
30+
<PropertyGroup>
31+
<RunScriptOutputDirectory>$(ArtifactsDir)/tests/coreclr/obj/$(TargetOS).$(Platform).$(Configuration)/Managed/build/iOSApps/$(TestProjectName)/AppBundle</RunScriptOutputDirectory>
32+
</PropertyGroup>
33+
</Target>
34+
1235
<!-- Default priority building values. -->
1336
<PropertyGroup>
1437
<DisableProjectBuild Condition="'$(IsMergedTestRunnerAssembly)' == 'true' and $(BuildAsStandalone)">true</DisableProjectBuild>
@@ -201,7 +224,7 @@
201224

202225
<!-- There are currently no native project binaries on wasm or Android -->
203226
<Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
204-
Condition="'@(NativeProjectBinaries)' == '' And '$(TargetOS)' != 'browser' And '$(TargetOS)' != 'android' And '$(TargetOS)' != 'ios' And '$(TargetOS)' != 'iossimulator'"/>
227+
Condition="'@(NativeProjectBinaries)' == '' And '$(TargetOS)' != 'browser' And '$(TargetsMobile)' != 'true'"/>
205228

206229
<Copy
207230
SourceFiles="@(NativeProjectBinaries)"

0 commit comments

Comments
 (0)