Skip to content

Commit bb921d6

Browse files
authored
Add test leg to the PR build to run libraries tests on iOS x64 Simulators (#37476)
Forked from #37057 Adds the iOS test leg that will execute selected BCL tests on an iOS x64 Simulator (13.5) using the `OSX.1015.Amd64.Open` queue which is our on-prem Mac Mini infrastructure (60 machines). To prepare the Helix job, we are using the Arcade Helix SDK, more specifically the [XHarness Helix SDK](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/Readme.md) which uses the [XHarness tool](https://github.com/dotnet/xharness) to control the test run.
1 parent 0923e83 commit bb921d6

7 files changed

Lines changed: 144 additions & 36 deletions

File tree

eng/pipelines/common/xplat-setup.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,8 @@ jobs:
112112
name: NetCoreInternal-Pool
113113
queue: BuildPool.Ubuntu.1604.Amd64
114114

115-
# Public OSX Build Pool
116-
${{ if eq(parameters.osGroup, 'OSX') }}:
117-
vmImage: 'macOS-10.14'
118-
119-
# Public OSX Build Pool
120-
${{ if eq(parameters.osGroup, 'iOS') }}:
121-
vmImage: 'macOS-10.14'
122-
123-
# Public OSX Build Pool
124-
${{ if eq(parameters.osGroup, 'tvOS') }}:
115+
# OSX Build Pool (we don't have on-prem OSX BuildPool
116+
${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
125117
vmImage: 'macOS-10.14'
126118

127119
${{ if eq(parameters.osGroup, 'Browser') }}:

eng/pipelines/libraries/helix-queues-setup.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ jobs:
9191
- OSX.1014.Amd64.Open
9292
- OSX.1015.Amd64.Open
9393

94+
# iOS x64/x86
95+
- ${{ if in(parameters.platform, 'iOS_x64', 'iOS_x86') }}:
96+
- OSX.1015.Amd64.Open
97+
9498
# Windows_NT x64
9599
- ${{ if eq(parameters.platform, 'Windows_NT_x64') }}:
96100
# netcoreapp

eng/pipelines/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ jobs:
290290
- Android_arm
291291
- tvOS_arm64
292292
- iOS_arm
293-
- iOS_x64
294293
- Linux_musl_x64
295294
jobParameters:
296295
testGroup: innerloop
@@ -313,6 +312,7 @@ jobs:
313312
buildConfig: Release
314313
runtimeFlavor: mono
315314
platforms:
315+
- iOS_x64
316316
- Browser_wasm
317317
variables:
318318
# map dependencies variables to local variables

eng/testing/AppleRunnerTemplate.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env bash
22

33
EXECUTION_DIR=$(dirname $0)
4-
TEST_NAME=$1
5-
TARGET_ARCH=$2
6-
TARGET=
7-
SCHEME_SDK=
4+
[[RunCommands]]
85

6+
# "Release" in SCHEME_SDK is what xcode produces (see "bool Optimized" property in AppleAppBuilderTask)
97
if [ "$TARGET_ARCH" == "arm" ]; then
108
TARGET=ios-device
119
SCHEME_SDK=Release-iphoneos
@@ -23,8 +21,6 @@ else
2321
exit 1
2422
fi
2523

26-
# "Release" in SCHEME_SDK is what xcode produces (see "bool Optimized" property in AppleAppBuilderTask)
27-
2824
APP_BUNDLE=$EXECUTION_DIR/$TEST_NAME/$SCHEME_SDK/$TEST_NAME.app
2925

3026
# it doesn't support parallel execution yet, so, here is a hand-made semaphore:
@@ -39,14 +35,17 @@ while true; do
3935
fi
4036
done
4137

42-
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
38+
XCODE_PATH="`xcode-select -p`/../.."
39+
export XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
4340

44-
dotnet xharness ios test --app="$APP_BUNDLE" \
45-
--targets=$TARGET \
41+
dotnet xharness ios test \
42+
--targets="$TARGET" \
43+
--app="$APP_BUNDLE" \
44+
--xcode="$XCODE_PATH" \
4645
--output-directory=$XHARNESS_OUT
4746

4847
_exitCode=$?
4948

50-
echo "Xharness artifacts: $XHARNESS_OUT"
49+
echo "XHarness artifacts: $XHARNESS_OUT"
5150

5251
exit $_exitCode

eng/testing/tests.mobile.targets

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
<RunScriptCommand>$HARNESS_RUNNER wasm test --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
1818
</PropertyGroup>
1919

20+
<ItemGroup>
21+
<RunScriptCommands Include="TEST_NAME=$(TestProjectName)" />
22+
<RunScriptCommands Include="TARGET_ARCH=$(TargetArchitecture)" />
23+
</ItemGroup>
24+
2025
<!-- Generate a self-contained app bundle for Android with tests. -->
2126
<UsingTask Condition="'$(TargetOS)' == 'Android'"
2227
TaskName="AndroidAppBuilderTask"
@@ -72,6 +77,7 @@
7277
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
7378
<Error Condition="('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm') and '$(DevTeamProvisioning)' == ''"
7479
Text="'DevTeamProvisioning' needs to be set for device builds. Set it to 'UBF8T346G9' if you're part of the Microsoft team account." />
80+
<Error Condition="'$(TestArchiveTestsDir)' == ''" Text="TestArchiveTestsDir property to archive the test folder must be set." />
7581

7682
<WriteLinesToFile File="$(PublishDir)xunit-excludes.txt" Lines="$(_withoutCategories.Replace(';', '%0dcategory='))" />
7783

@@ -114,7 +120,16 @@
114120
</AppleAppBuilderTask>
115121
<Message Importance="High" Text="Xcode: $(XcodeProjectPath)"/>
116122
<Message Importance="High" Text="App: $(AppBundlePath)"/>
117-
<!-- This app is now can be consumed by xharness CLI to deploy on a device or simulator -->
123+
124+
<ItemGroup>
125+
<_appFiles Include="$(AppBundlePath)/../**/*" />
126+
</ItemGroup>
127+
128+
<Copy SourceFiles="@(_appFiles)"
129+
DestinationFolder="$(TestArchiveTestsDir)/%(RecursiveDir)"
130+
SkipUnchangedFiles="true"
131+
Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'" />
132+
118133
</Target>
119134

120135
<UsingTask TaskName="WasmAppBuilder"

src/libraries/sendtohelixhelp.proj

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<HelixBuild Condition="'$(HelixBuild)' == ''">$(BUILD_BUILDNUMBER)</HelixBuild>
1313
<HelixBuild Condition="'$(HelixBuild)' == ''">default</HelixBuild>
1414

15-
<!-- Normal jobs have a 30 minute (1800 sec.) timeout for arm/arm64, and 15 minute (900 sec.) timeout otherwise.
15+
<!-- Normal jobs have a 30 minute timeout for arm/arm64, and 15 minute timeout otherwise.
1616
Stress modes can take considerably longer, so double those numbers. And GCStress is even slower.
1717
-->
18-
<TimeoutInSeconds Condition="
18+
<_workItemTimeout Condition="
1919
'$(Scenario)' == 'gcstress0x3' or
2020
'$(Scenario)' == 'gcstress0xc' or
2121
'$(Scenario)' == 'heapverify1' or
@@ -24,13 +24,12 @@
2424
'$(Scenario)' == 'gcstress0xc_zapdisable_heapverify1' or
2525
'$(Scenario)' == 'gcstress0xc_jitstress1' or
2626
'$(Scenario)' == 'gcstress0xc_jitstress2' or
27-
'$(Scenario)' == 'gcstress0xc_jitminopts_heapverify1'">5400</TimeoutInSeconds>
28-
<TimeoutInSeconds Condition="'$(Scenario)' == '' and '$(TimeoutInSeconds)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">1800</TimeoutInSeconds>
29-
<TimeoutInSeconds Condition="'$(Scenario)' != '' and '$(TimeoutInSeconds)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">3600</TimeoutInSeconds>
30-
<TimeoutInSeconds Condition="'$(Scenario)' == '' and '$(TimeoutInSeconds)' == ''">900</TimeoutInSeconds>
31-
<TimeoutInSeconds Condition="'$(Scenario)' != '' and '$(TimeoutInSeconds)' == ''">1800</TimeoutInSeconds>
32-
33-
<_timeoutSpan>$([System.TimeSpan]::FromSeconds($(TimeoutInSeconds)))</_timeoutSpan>
27+
'$(Scenario)' == 'gcstress0xc_jitminopts_heapverify1'">01:30:00</_workItemTimeout>
28+
<_workItemTimeout Condition="'$(_workItemTimeout)' == '' and ('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS')">00:30:00</_workItemTimeout>
29+
<_workItemTimeout Condition="'$(Scenario)' == '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">00:45:00</_workItemTimeout>
30+
<_workItemTimeout Condition="'$(Scenario)' != '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">01:00:00</_workItemTimeout>
31+
<_workItemTimeout Condition="'$(Scenario)' == '' and '$(_workItemTimeout)' == ''">00:15:00</_workItemTimeout>
32+
<_workItemTimeout Condition="'$(Scenario)' != '' and '$(_workItemTimeout)' == ''">00:30:00</_workItemTimeout>
3433

3534
<!-- We need to enable xunit reporter so that it parses test results
3635
Package testing doesn't run on xunit. -->
@@ -73,7 +72,7 @@
7372
<HelixType Condition="'$(TestPackages)' == 'true'">test/functional/packaging/</HelixType>
7473
</PropertyGroup>
7574

76-
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
75+
<PropertyGroup Condition="'$(TargetOS)' == 'Browser' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'">
7776
<IncludeXHarnessCli>true</IncludeXHarnessCli>
7877
</PropertyGroup>
7978

@@ -162,9 +161,22 @@
162161
<Message Importance="High" Text="Using HelixCommand: $(HelixCommand)" />
163162
<Message Importance="High" Text="Using HelixType: $(HelixType)" />
164163
<Message Importance="High" Text="Using WorkItemArchiveWildCard: $(WorkItemArchiveWildCard)" />
165-
<Message Importance="High" Text="Using Timeout: $(_timeoutSpan)" />
164+
<Message Importance="High" Text="Using Timeout: $(_workItemTimeout)" />
165+
166+
<ItemGroup Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'">
167+
<!-- Find all directories named *.app -->
168+
<XHarnessAppBundleToTest Include="$([System.IO.Directory]::GetDirectories('$(TestArchiveTestsRoot)', '*.app', System.IO.SearchOption.AllDirectories))">
169+
<Targets Condition="'$(TargetArchitecture)' == 'arm'">ios-device</Targets>
170+
<Targets Condition="'$(TargetArchitecture)' == 'arm64'">ios-device</Targets>
171+
<Targets Condition="'$(TargetArchitecture)' == 'x64'">ios-simulator-64</Targets>
172+
<Targets Condition="'$(TargetArchitecture)' == 'x86'">ios-simulator-32</Targets>
173+
174+
<TestTimeout>$(_workItemTimeout)</TestTimeout>
175+
<LaunchTimeout>$(_workItemTimeout)</LaunchTimeout>
176+
</XHarnessAppBundleToTest>
177+
</ItemGroup>
166178

167-
<ItemGroup>
179+
<ItemGroup Condition="'$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'tvOS'">
168180
<HelixCorrelationPayload Include="$(HelixCorrelationPayload)"
169181
Condition="'$(IncludeHelixCorrelationPayload)' == 'true'" />
170182

@@ -173,12 +185,13 @@
173185
<HelixWorkItem Include="@(_WorkItem -> '%(FileName)')">
174186
<PayloadArchive>%(Identity)</PayloadArchive>
175187
<Command>$(HelixCommand)</Command>
176-
<Timeout>$(_timeoutSpan)</Timeout>
188+
<Timeout>$(_workItemTimeout)</Timeout>
177189
</HelixWorkItem>
178190
</ItemGroup>
179191

180192
<Message Condition="'$(Scenario)' != ''" Importance="High" Text="Done building Helix work items for scenario $(Scenario). Work item count: @(_WorkItem->Count())" />
181-
<Message Condition="'$(Scenario)' == ''" Importance="High" Text="Done building Helix work items. Work item count: @(_WorkItem->Count())" />
193+
<Message Condition="'$(Scenario)' == '' and ('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS')" Importance="High" Text="Done building Helix work items. Work item count: @(XHarnessAppBundleToTest->Count())" />
194+
<Message Condition="'$(Scenario)' == '' and '$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'tvOS'" Importance="High" Text="Done building Helix work items. Work item count: @(_WorkItem->Count())" />
182195

183196
</Target>
184197

0 commit comments

Comments
 (0)