Skip to content

Commit 4d333e1

Browse files
authored
Run nativeaot tests in helix (#81439)
This changes the existing NativeAot smoke test runs to run in helix. The multi-module test run (only supported on windows) now runs only in the checked configuration, to avoid having to add a separate windows build script invocation inside one of the yaml templates.
1 parent 6ad1205 commit 4d333e1

File tree

9 files changed

+87
-41
lines changed

9 files changed

+87
-41
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ parameters:
22
buildConfig: ''
33
osSubgroup: ''
44
container: ''
5-
testGroup: ''
5+
testBuildArgs: ''
66
crossBuild: false
77
readyToRun: false
88
liveLibrariesBuildConfig: ''
99
compositeBuildMode: false
1010
helixQueues: ''
1111
displayNameArgs: ''
1212
runInUnloadableContext: false
13+
nativeAotTest: false
1314
runtimeFlavor: 'mono'
1415
runtimeVariant: 'monointerpreter'
1516
variables: {}
@@ -26,11 +27,11 @@ parameters:
2627

2728
steps:
2829
- ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
29-
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) /p:RuntimeVariant=${{ parameters.runtimeVariant }} /p:LibrariesConfiguration=${{ parameters.buildConfig }} -mono -ci os ${{ parameters.osGroup }} ${{ parameters.archType }} $(buildConfigUpper)
30+
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) /p:RuntimeVariant=${{ parameters.runtimeVariant }} ${{ parameters.testBuildArgs }} -mono os ${{ parameters.osGroup }} ${{ parameters.archType }} $(buildConfigUpper) /p:LibrariesConfiguration=${{ parameters.buildConfig }} -ci
3031
displayName: Build Tests
3132

3233
- ${{ if ne(parameters.runtimeFlavor, 'mono') }}:
33-
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) /p:LibrariesConfiguration=${{ parameters.buildConfig }} -ci os ${{ parameters.osGroup }} ${{ parameters.archType }} $(buildConfigUpper)
34+
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) ${{ parameters.archType }} $(buildConfigUpper) ${{ parameters.testBuildArgs }} -ci
3435
displayName: Build Tests
3536

3637

@@ -104,6 +105,7 @@ steps:
104105
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
105106
compositeBuildMode: ${{ parameters.compositeBuildMode }}
106107
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
108+
nativeAotTest: ${{ parameters.nativeAotTest }}
107109

108110
${{ if eq(variables['System.TeamProject'], 'internal') }}:
109111
# Access token variable for internal project from the

eng/pipelines/common/templates/runtimes/build-test-job.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,8 @@ jobs:
9898

9999
# Only build GCSimulator tests when the gc-simulator group is specified.
100100
- ${{ if eq(parameters.testGroup, 'gc-simulator') }}:
101-
- ${{ if eq(parameters.osGroup, 'windows') }}:
102101
- name: testTreeFilterArg
103102
value: 'tree GC/Scenarios/GCSimulator'
104-
- ${{ if ne(parameters.osGroup, 'windows') }}:
105-
- name: testTreeFilterArg
106-
value: '-tree:GC/Scenarios/GCSimulator'
107103

108104
steps:
109105

eng/pipelines/common/templates/runtimes/run-test-job.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,8 @@ jobs:
139139

140140
# Only build GCSimulator tests when the gc-simulator group is specified.
141141
- ${{ if eq(parameters.testGroup, 'gc-simulator') }}:
142-
- ${{ if eq(parameters.osGroup, 'windows') }}:
143-
- name: testTreeFilterArg
144-
value: 'tree GC/Scenarios/GCSimulator'
145-
- ${{ if ne(parameters.osGroup, 'windows') }}:
146-
- name: testTreeFilterArg
147-
value: '-tree:GC/Scenarios/GCSimulator'
142+
- name: testTreeFilterArg
143+
value: 'tree GC/Scenarios/GCSimulator'
148144

149145
# Variables used for SuperPMI collection
150146
- ${{ if eq(parameters.SuperPmiCollect, true) }}:

eng/pipelines/common/templates/runtimes/send-to-helix-step.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ parameters:
2222
helixProjectArguments: ''
2323
runInUnloadableContext: ''
2424
tieringTest: ''
25+
nativeAotTest: ''
2526
longRunningGcTests: ''
2627
gcSimulatorTests: ''
2728
runtimeFlavor: 'CoreCLR'
@@ -51,6 +52,7 @@ steps:
5152
_CompositeBuildMode: ${{ parameters.compositeBuildMode }}
5253
_RunInUnloadableContext: ${{ parameters.runInUnloadableContext }}
5354
_TieringTest: ${{ parameters.tieringTest }}
55+
_NativeAotTest: ${{ parameters.nativeAotTest }}
5456
_LongRunningGcTests: ${{ parameters.longRunningGcTests }}
5557
_GcSimulatorTests: ${{ parameters.gcSimulatorTests }}
5658
_Scenarios: ${{ join(',', parameters.scenarios) }}

eng/pipelines/coreclr/nativeaot-post-build-steps.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,25 @@ parameters:
33
archType: ''
44
osGroup: ''
55
osSubgroup: ''
6-
platform: ''
7-
pgoType: ''
8-
runtimeVariant: ''
9-
uploadTests: false
10-
testFilter: tree nativeaot
11-
runSingleFileTests: true
6+
testBuildArgs: ''
7+
helixQueues: ''
128

139
steps:
1410
# Can't run arm/arm64 tests on x64 build machines
1511
- ${{ if and(ne(parameters.archType, 'arm'), ne(parameters.archType, 'arm64')) }}:
1612

17-
# Build coreclr native test output
18-
- ${{ if eq(parameters.osGroup, 'windows') }}:
19-
- script: $(Build.SourcesDirectory)/src/tests/build.cmd nativeaot $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.testFilter }} /p:BuildNativeAotFrameworkObjects=true
20-
displayName: Build tests
21-
- ${{ if ne(parameters.osGroup, 'windows') }}:
22-
- script: $(Build.SourcesDirectory)/src/tests/build.sh nativeaot $(buildConfigUpper) ${{ parameters.archType }} '${{ parameters.testFilter }}'
23-
displayName: Build tests
24-
25-
- ${{ if eq(parameters.runSingleFileTests, true) }}:
26-
- ${{ if eq(parameters.osGroup, 'windows') }}:
27-
- script: $(Build.SourcesDirectory)/src/tests/run.cmd runnativeaottests $(buildConfigUpper) ${{ parameters.archType }}
28-
displayName: Run tests in single file mode
29-
- ${{ if ne(parameters.osGroup, 'windows') }}:
30-
- script: $(Build.SourcesDirectory)/src/tests/run.sh --runnativeaottests $(buildConfigUpper) ${{ parameters.archType }}
31-
displayName: Run tests in single file mode
13+
# Build coreclr native test output and send to helix
14+
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
15+
parameters:
16+
buildConfig: ${{ parameters.buildConfig }}
17+
archType: ${{ parameters.archType }}
18+
osGroup: ${{ parameters.osGroup }}
19+
osSubgroup: ${{ parameters.osSubgroup }}
20+
runtimeFlavor: coreclr
21+
runtimeVariant: ''
22+
testBuildArgs: ${{ parameters.testBuildArgs }}
23+
nativeAotTest: true
24+
helixQueues: ${{ parameters.helixQueues }}
3225

3326
# Publishing tooling doesn't support different configs between runtime and libs, so only run tests in Release config
3427
- ${{ if eq(parameters.buildConfig, 'release') }}:

eng/pipelines/runtime.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,26 @@ extends:
195195
- template: /eng/pipelines/common/platform-matrix.yml
196196
parameters:
197197
jobTemplate: /eng/pipelines/common/global-build-job.yml
198-
buildConfig: debug
198+
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
199+
buildConfig: Debug
199200
platforms:
200201
- linux_x64
201202
- windows_x64
203+
variables:
204+
- name: timeoutPerTestInMinutes
205+
value: 60
206+
- name: timeoutPerTestCollectionInMinutes
207+
value: 180
202208
jobParameters:
203209
testGroup: innerloop
204210
timeoutInMinutes: 120
205211
nameSuffix: NativeAOT
206212
buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
207213
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
214+
extraStepsParameters:
215+
creator: dotnet-bot
216+
testBuildArgs: nativeaot tree nativeaot
217+
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
208218
condition: >-
209219
or(
210220
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
@@ -218,15 +228,25 @@ extends:
218228
- template: /eng/pipelines/common/platform-matrix.yml
219229
parameters:
220230
jobTemplate: /eng/pipelines/common/global-build-job.yml
221-
buildConfig: checked
231+
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
232+
buildConfig: Checked
222233
platforms:
223234
- windows_x64
235+
variables:
236+
- name: timeoutPerTestInMinutes
237+
value: 60
238+
- name: timeoutPerTestCollectionInMinutes
239+
value: 180
224240
jobParameters:
225241
testGroup: innerloop
226242
timeoutInMinutes: 120
227243
nameSuffix: NativeAOT
228244
buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
229245
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
246+
extraStepsParameters:
247+
creator: dotnet-bot
248+
testBuildArgs: nativeaot tree nativeaot /p:BuildNativeAotFrameworkObjects=true
249+
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
230250
condition: >-
231251
or(
232252
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
@@ -240,17 +260,27 @@ extends:
240260
- template: /eng/pipelines/common/platform-matrix.yml
241261
parameters:
242262
jobTemplate: /eng/pipelines/common/global-build-job.yml
243-
buildConfig: release
263+
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
264+
buildConfig: Release
244265
platforms:
245266
- linux_x64
246267
- windows_x64
247268
- osx_x64
269+
variables:
270+
- name: timeoutPerTestInMinutes
271+
value: 60
272+
- name: timeoutPerTestCollectionInMinutes
273+
value: 180
248274
jobParameters:
249275
testGroup: innerloop
250276
timeoutInMinutes: 120
251277
nameSuffix: NativeAOT
252278
buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
253279
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
280+
extraStepsParameters:
281+
creator: dotnet-bot
282+
testBuildArgs: nativeaot tree nativeaot
283+
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
254284
condition: >-
255285
or(
256286
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),

src/tests/Common/helixpublishwitharcade.proj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<_GcSimulatorTests>false</_GcSimulatorTests>
4141
<_RunInUnloadableContext>false</_RunInUnloadableContext>
4242
<_TieringTest>false</_TieringTest>
43+
<_NativeAotTest>false</_NativeAotTest>
4344
<_TimeoutPerTestCollectionInMinutes>123</_TimeoutPerTestCollectionInMinutes>
4445
<_TimeoutPerTestInMinutes>234</_TimeoutPerTestInMinutes>
4546
<_RuntimeVariant></_RuntimeVariant>
@@ -95,6 +96,7 @@
9596
GcSimulatorTests=$(_GcSimulatorTests);
9697
RunInUnloadableContext=$(_RunInUnloadableContext);
9798
TieringTest=$(_TieringTest);
99+
NativeAotTest=$(_NativeAotTest);
98100
TimeoutPerTestCollectionInMinutes=$(_TimeoutPerTestCollectionInMinutes);
99101
TimeoutPerTestInMinutes=$(_TimeoutPerTestInMinutes);
100102
RuntimeVariant=$(_RuntimeVariant);
@@ -288,6 +290,8 @@
288290
<Copy SourceFiles="$(MSBuildThisFileDirectory)scripts/runincontext.sh" DestinationFolder="$(CoreRootDirectory)" Condition=" '$(TestWrapperTargetsWindows)' != 'true' and '$(_RunInUnloadableContext)' == 'true'" />
289291
<Copy SourceFiles="$(MSBuildThisFileDirectory)scripts\tieringtest.cmd" DestinationFolder="$(CoreRootDirectory)" Condition=" '$(TestWrapperTargetsWindows)' == 'true' and '$(_TieringTest)' == 'true'" />
290292
<Copy SourceFiles="$(MSBuildThisFileDirectory)scripts/tieringtest.sh" DestinationFolder="$(CoreRootDirectory)" Condition=" '$(TestWrapperTargetsWindows)' != 'true' and '$(_TieringTest)' == 'true'" />
293+
<Copy SourceFiles="$(MSBuildThisFileDirectory)scripts\nativeaottest.cmd" DestinationFolder="$(CoreRootDirectory)" Condition=" '$(TestWrapperTargetsWindows)' == 'true' and '$(_NativeAotTest)' == 'true'" />
294+
<Copy SourceFiles="$(MSBuildThisFileDirectory)scripts/nativeaottest.sh" DestinationFolder="$(CoreRootDirectory)" Condition=" '$(TestWrapperTargetsWindows)' != 'true' and '$(_NativeAotTest)' == 'true'" />
291295

292296
<ItemGroup Condition=" '$(SuperPmiCollect)' == 'true' ">
293297
<!-- We need superpmi.py and its dependencies; this is an over-approximation. The HelixCorrelationPayload directory is CoreRootDirectory, so copy the scripts there. -->
@@ -602,6 +606,7 @@
602606
<HelixPreCommand Include="set RunTieringTest=1" Condition=" '$(TieringTest)' == 'true' " />
603607
<HelixPreCommand Include="set CLRCustomTestLauncher=%HELIX_CORRELATION_PAYLOAD%\runincontext.cmd" Condition=" '$(RunInUnloadableContext)' == 'true' " />
604608
<HelixPreCommand Include="set CLRCustomTestLauncher=%HELIX_CORRELATION_PAYLOAD%\tieringtest.cmd" Condition=" '$(TieringTest)' == 'true' " />
609+
<HelixPreCommand Include="set CLRCustomTestLauncher=%HELIX_CORRELATION_PAYLOAD%\nativeaottest.cmd" Condition=" '$(NativeAotTest)' == 'true' " />
605610
<HelixPreCommand Include="set __TestEnv=%HELIX_WORKITEM_PAYLOAD%\$(TestEnvFileName)" />
606611
<HelixPreCommand Include="set __TestTimeout=$(TimeoutPerTestInMilliseconds)" Condition=" '$(TimeoutPerTestInMilliseconds)' != '' " />
607612
<HelixPreCommand Include="set __CollectDumps=1" />
@@ -650,6 +655,7 @@
650655
<HelixPreCommand Include="export RunTieringTest=1" Condition=" '$(TieringTest)' == 'true' " />
651656
<HelixPreCommand Include="export CLRCustomTestLauncher=$HELIX_CORRELATION_PAYLOAD/runincontext.sh" Condition=" '$(RunInUnloadableContext)' == 'true' " />
652657
<HelixPreCommand Include="export CLRCustomTestLauncher=$HELIX_CORRELATION_PAYLOAD/tieringtest.sh" Condition=" '$(TieringTest)' == 'true' " />
658+
<HelixPreCommand Include="export CLRCustomTestLauncher=$HELIX_CORRELATION_PAYLOAD/nativeaottest.sh" Condition=" '$(NativeAotTest)' == 'true' " />
653659
<HelixPreCommand Include="export __TestEnv=$HELIX_WORKITEM_PAYLOAD/$(TestEnvFileName)" />
654660
<HelixPreCommand Include="export __TestTimeout=$(TimeoutPerTestInMilliseconds)" Condition=" '$(TimeoutPerTestInMilliseconds)' != '' " />
655661
<HelixPreCommand Include="export __CollectDumps=1" />

src/tests/Common/scripts/nativeaottest.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
# 3. - n. Additional arguments that were passed to the test .sh
1212

1313
exename=$(basename $2 .dll)
14+
chmod +x $1/native/$exename
1415
$_DebuggerFullPath $1/native/$exename "${@:3}"

src/tests/build.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,34 @@ handle_arguments_local() {
234234
test*|-test*)
235235
local arg="$1"
236236
local parts=(${arg//:/ })
237-
__BuildTestProject="$__BuildTestProject${parts[1]}%3B"
237+
if [[ ${#parts[@]} -eq 1 ]]; then
238+
shift
239+
__BuildTestProject="$__BuildTestProject$1%3B"
240+
else
241+
__BuildTestProject="$__BuildTestProject${parts[1]}%3B"
242+
fi
238243
;;
239244

240245
dir*|-dir*)
241246
local arg="$1"
242247
local parts=(${arg//:/ })
243-
__BuildTestDir="$__BuildTestDir${parts[1]}%3B"
248+
if [[ ${#parts[@]} -eq 1 ]]; then
249+
shift
250+
__BuildTestDir="$__BuildTestDir$1%3B"
251+
else
252+
__BuildTestDir="$__BuildTestDir${parts[1]}%3B"
253+
fi
244254
;;
245255

246256
tree*|-tree*)
247257
local arg="$1"
248258
local parts=(${arg//:/ })
249-
__BuildTestTree="$__BuildTestTree${parts[1]}%3B"
259+
if [[ ${#parts[@]} -eq 1 ]]; then
260+
shift
261+
__BuildTestTree="$__BuildTestTree$1%3B"
262+
else
263+
__BuildTestTree="$__BuildTestTree${parts[1]}%3B"
264+
fi
250265
;;
251266

252267
runtests|-runtests)
@@ -284,7 +299,12 @@ handle_arguments_local() {
284299
log*|-log*)
285300
local arg="$1"
286301
local parts=(${arg//:/ })
287-
__BuildLogRootName="${parts[1]}"
302+
if [[ ${#parts[@]} -eq 1 ]]; then
303+
shift
304+
__BuildLogRootName="$1"
305+
else
306+
__BuildLogRootName="${parts[1]}"
307+
fi
288308
;;
289309

290310
*)

0 commit comments

Comments
 (0)