Skip to content
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

Use merged runners for ios tests #107118

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ parameters:
variables: {}
pool: ''
dependsOn: []
compileOnHelix: false
interpreter: false
extraHelixArguments: ''
buildAllTestsAsStandalone: false
#arcade-specific parameters
condition: always()
Expand Down Expand Up @@ -85,64 +84,49 @@ steps:
env:
__MonoToolPrefix: aarch64-linux-gnu-

# Checks the value of the compileOnHelix parameter
# and if set invokes libraries pipeline for AOT on Helix
- ${{ if eq(parameters.compileOnHelix, 'true') }}:
- template: /eng/pipelines/libraries/helix.yml
parameters:
osGroup: ${{ parameters.osGroup }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
archType: ${{ parameters.archType }}
targetRid: ${{ parameters.targetRid }}
buildConfig: ${{ parameters.buildConfig }}
interpreter: ${{ parameters.interpreter }}
testRunNamePrefixSuffix: ${{ parameters.testRunNamePrefixSuffix }}
extraHelixArguments: ${{ parameters.extraHelixArguments }}
helixQueues: ${{ parameters.helixQueues }}
creator: ${{ parameters.creator }}
- ${{ else }}:
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
parameters:
displayName: Send tests to Helix
buildConfig: $(buildConfigUpper)
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup}}
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
parameters:
displayName: Send tests to Helix
buildConfig: $(buildConfigUpper)
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup}}
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}

${{ if eq(variables['System.TeamProject'], 'public') }}:
creator: $(Build.DefinitionName)
${{ if eq(variables['System.TeamProject'], 'public') }}:
creator: $(Build.DefinitionName)

helixBuild: $(Build.BuildNumber)
helixSource: $(_HelixSource)
helixBuild: $(Build.BuildNumber)
helixSource: $(_HelixSource)

${{ if ne(parameters.readyToRun, true) }}:
helixType: 'test/functional/cli/'
${{ if ne(parameters.readyToRun, true) }}:
helixType: 'test/functional/cli/'

helixQueues: ${{ parameters.helixQueues }}
helixQueues: ${{ parameters.helixQueues }}

# This tests whether an array is empty
${{ if eq(join('', parameters.helixQueues), '') }}:
condition: false
# This tests whether an array is empty
${{ if eq(join('', parameters.helixQueues), '') }}:
condition: false

publishTestResults: true
publishTestResults: true

timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)

runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
compositeBuildMode: ${{ parameters.compositeBuildMode }}
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
nativeAotTest: ${{ parameters.nativeAotTest }}
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
compositeBuildMode: ${{ parameters.compositeBuildMode }}
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
nativeAotTest: ${{ parameters.nativeAotTest }}

${{ if eq(variables['System.TeamProject'], 'internal') }}:
# Access token variable for internal project from the
# DotNet-HelixApi-Access variable group
helixAccessToken: $(HelixApiAccessToken)
${{ if eq(variables['System.TeamProject'], 'internal') }}:
# Access token variable for internal project from the
# DotNet-HelixApi-Access variable group
helixAccessToken: $(HelixApiAccessToken)

helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
extraHelixArguments: ${{ parameters.extraHelixArguments }}

scenarios: ${{ parameters.scenarios }}
scenarios: ${{ parameters.scenarios }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ parameters:
runCrossGen2: ''
compositeBuildMode: false
helixProjectArguments: ''
extraHelixArguments: ''
runInUnloadableContext: ''
tieringTest: ''
hotColdSplitting: ''
Expand All @@ -38,7 +39,7 @@ steps:
- template: send-to-helix-inner-step.yml
parameters:
osGroup: ${{ parameters.osGroup }}
sendParams: ${{ parameters.helixProjectArguments }} ${{ parameters.msbuildParallelism }} /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }}
sendParams: ${{ parameters.helixProjectArguments }} ${{ parameters.msbuildParallelism }} /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }} ${{ parameters.extraHelixArguments }}
condition: and(succeeded(), ${{ parameters.condition }})
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
displayName: ${{ parameters.displayName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ jobs:
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
parameters:
creator: dotnet-bot
compileOnHelix: true
interpreter: true
testBuildArgs: /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
extraHelixArguments: /p:MonoForceInterpreter=true /p:NeedsToBuildAppsOnHelix=true

#
# iOS/tvOS devices
Expand Down
109 changes: 104 additions & 5 deletions src/tests/Common/helixpublishwitharcade.proj
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,19 @@
</Target>

<Target Name="DiscoverMergedTestWrappers">
<!-- Mobile tests use a run script that's generated into the bundle as the execution script -->
<PropertyGroup Condition="'$(TargetsMobile)' == 'true'">
<_AppBundleRunScriptName>RunTests</_AppBundleRunScriptName>
<_AppBundleRunScriptName Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true'">build-apple-app</_AppBundleRunScriptName>
</PropertyGroup>

<ItemGroup>
<!-- Exclude WASM support files. They can interfere with our discovery process and create extra work items that don't work. -->
<_MergedWrapperMarker Include="$(TestBinDir)**\*.MergedTestAssembly" Exclude="$(TestBinDir)**\supportFiles\*.MergedTestAssembly" />

<_MergedWrapperMarker Update="@(_MergedWrapperMarker)">
<TestExecutionScriptPath Condition="'$(TargetsMobile)' != 'true'">$([System.IO.Path]::ChangeExtension('%(Identity)', '.$(TestScriptExtension)'))</TestExecutionScriptPath>
<TestExecutionScriptPath Condition="'$(TargetsMobile)' == 'true'">%(RootDir)%(Directory)AppBundle/RunTests.$(TestScriptExtension)</TestExecutionScriptPath>
<TestExecutionScriptPath Condition="'$(TargetsMobile)' == 'true'">%(RootDir)%(Directory)AppBundle/$(_AppBundleRunScriptName).$(TestScriptExtension)</TestExecutionScriptPath>
</_MergedWrapperMarker>

<!-- Exclude merged test wrappers without the test execution script for this target (skipped due to CLRTestTargetUnsupported et al) -->
Expand Down Expand Up @@ -536,7 +542,7 @@
</Target>

<Target Name="PrepareMergedTestPayloadDirectoryForAppleMobile"
Condition="'$(TargetsAppleMobile)' == 'true'"
Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' != 'true'"
Outputs="%(_MergedWrapperMarker.FileName)"
DependsOnTargets="DiscoverMergedTestWrappers;GetTestExclusionList">

Expand Down Expand Up @@ -573,9 +579,45 @@
<WriteLinesToFile File="@(_TestExclusionListPlaceholder->'$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\%(FileRelativeToPayloadsRootDirectory)')"
Lines="@(FilteredTestExclusionList)"
Condition="'@(_TestExclusionListPlaceholder)' != ''" />
</Target>
</Target>

<Target Name="PrepareMergedTestPayloadDirectoryForAppleMobileBuildOnHelix"
Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true'"
Outputs="%(_MergedWrapperMarker.FileName)"
DependsOnTargets="DiscoverMergedTestWrappers;GetTestExclusionList">

<PropertyGroup Condition="'@(_MergedWrapperMarker)' != ''" >
<_MergedWrapperDirectory>%(_MergedWrapperMarker.RootDir)%(Directory)</_MergedWrapperDirectory>
<_MergedWrapperName>%(_MergedWrapperMarker.FileName)</_MergedWrapperName>
</PropertyGroup>

<ItemGroup Condition="'@(_MergedWrapperMarker)' != ''" >
<_MergedPayloadGroups Include="$(_MergedWrapperName)" />
<_MergedPayloadFiles Include="$(_MergedWrapperDirectory)AppBundle/**" />
<_MergedPayloadFiles Update="@(_MergedPayloadFiles)" Condition="'@(_MergedPayloadFiles)' != ''" >
<!-- Never use [MSBuild]::MakeRelative here! We have some files containing Unicode characters in their %(FullPath) and
MakeRelative function calls Escape function internally that replaces all the Unicode characters with %<xx>. -->
<FileRelativeToPayloadsRootDirectory>$([System.IO.Path]::GetRelativePath('$(_MergedWrapperDirectory)AppBundle/', %(FullPath)))</FileRelativeToPayloadsRootDirectory>
</_MergedPayloadFiles>
<!-- Remove the placeholder test exclusion list here -->
<_TestExclusionListPlaceholder Include="@(_MergedPayloadFiles)" Condition="$([System.String]::new('%(FileName)').EndsWith('TestExclusionList'))" />
<_MergedPayloadFiles Remove="@(_TestExclusionListPlaceholder)" />
</ItemGroup>

<Copy SourceFiles="@(_MergedPayloadFiles)" DestinationFiles="@(_MergedPayloadFiles->'$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\%(FileRelativeToPayloadsRootDirectory)')" />
<!-- Write the real test exclusion list instead of the placeholder. -->
<WriteLinesToFile File="@(_TestExclusionListPlaceholder->'$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\%(FileRelativeToPayloadsRootDirectory)')"
Lines="@(FilteredTestExclusionList)"
Condition="'@(_TestExclusionListPlaceholder)' != ''" />
</Target>

<Target Name="PrepareMergedTestPayloadDirectory" DependsOnTargets="DiscoverMergedTestWrappers;PrepareMergedTestPayloadDirectoryForDesktop;PrepareMergedTestPayloadDirectoryForAndroid;PrepareMergedTestPayloadDirectoryForWasm;PrepareMergedTestPayloadDirectoryForAppleMobile" />
<Target Name="PrepareMergedTestPayloadDirectory"
DependsOnTargets="DiscoverMergedTestWrappers;
PrepareMergedTestPayloadDirectoryForDesktop;
PrepareMergedTestPayloadDirectoryForAndroid;
PrepareMergedTestPayloadDirectoryForWasm;
PrepareMergedTestPayloadDirectoryForAppleMobile;
PrepareMergedTestPayloadDirectoryForAppleMobileBuildOnHelix" />

<Target Name="ZipLegacyPayloadDirectory" AfterTargets="PrepareLegacyPayloadDirectories" Condition="'$(TargetHasHelixXHarnessSdkSupport)' == 'true'">
<ItemGroup>
Expand All @@ -592,7 +634,9 @@
DestinationFile="$(LegacyPayloadsRootDirectory)\%(LegacyPayloads.PayloadGroup).zip" />
</Target>

<Target Name="ZipMergedPayloadDirectory" AfterTargets="PrepareMergedTestPayloadDirectories" Condition="'$(TargetsBrowser)' == 'true'">
<Target Name="ZipMergedPayloadDirectory"
AfterTargets="PrepareMergedTestPayloadDirectories"
Condition="'$(TargetsBrowser)' == 'true' or ('$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true')">
<ItemGroup>
<MergedPayloads Include="$([System.IO.Directory]::GetDirectories($(MergedPayloadsRootDirectory)))" Condition="Exists('$(MergedPayloadsRootDirectory)')" />
<MergedPayloads Update="@(MergedPayloads)">
Expand Down Expand Up @@ -863,6 +907,61 @@
</ItemGroup>
</Target>

<!--
When we're building the apple mobile apps on Helix instead of during the build, we need to add a lot of assets to the Helix jobs
and modify how we submit the items to Helix.
We also won't discover the payloads through the normal way (as we won't have .app bundles to discover).
-->
<Target Name="PrepareAppleMobileBuildOnHelixWorkItems" BeforeTargets="CoreTest" Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true'">
<PropertyGroup>
<iOSLikeBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'apple', 'build'))</iOSLikeBuildTargetsDir>
<iOSLikeLibraryBuilderTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'common'))</iOSLikeLibraryBuilderTargetsDir>
<CMakeUrl>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/macos/cmake/cmake-3.28.0-macos-universal.tar.gz</CMakeUrl>

<_XHarnessAppleCustomCommand>
source build-apple-app.sh
</_XHarnessAppleCustomCommand>
<_RuntimeComponentManifestDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'build'))</_RuntimeComponentManifestDir>
</PropertyGroup>

<ItemGroup>
<HelixCorrelationPayload Include="cmake" Uri="$(CMakeUrl)" Destination="build/cmake" />
<HelixCorrelationPayload Include="$(AppleAppBuilderDir)" Destination="build/AppleAppBuilder" />
<HelixCorrelationPayload Include="$(LibraryBuilderDir)" Destination="build/LibraryBuilder" />
<HelixCorrelationPayload Include="$(MonoAOTCompilerDir)" Condition="'$(RuntimeFlavor)' == 'mono'"
Destination="build/MonoAOTCompiler" />
<HelixCorrelationPayload Include="$(MicrosoftNetCoreAppRuntimePackDir)" Destination="build/microsoft.netcore.app.runtime.$(TargetOS)-$(TargetArchitecture.ToLower())" />
<HelixCorrelationPayload Include="$(_RuntimeComponentManifestDir)" Condition="'$(RuntimeFlavor)' == 'mono'"
Destination="build/microsoft.netcore.app.runtime.$(TargetOS)-$(TargetArchitecture.ToLower())/runtimes/$(TargetOS)-$(TargetArchitecture.ToLower())/build" />
<HelixCorrelationPayload Include="$(iOSLikeBuildTargetsDir)" Destination="build/apple" />
<HelixCorrelationPayload Include="$(iOSLikeLibraryBuilderTargetsDir)" Destination="build/common" />
<HelixCorrelationPayload Include="$(MonoAotCrossDir)" Condition="'$(RuntimeFlavor)' == 'mono'"
Destination="build/cross" />
<HelixCorrelationPayload Include="$(MonoTargetsTasksDir)" Destination="build/MonoTargetsTasks" />
<HelixCorrelationPayload Include="$(CoreCLRCrossILCompilerDir)" Condition="'$(RuntimeFlavor)' == 'coreclr'"
Destination="build/ilc" />
<HelixCorrelationPayload Include="$(CoreCLRBuildIntegrationDir)" Condition="'$(RuntimeFlavor)' == 'coreclr'"
Destination="build/BuildIntegration" />
<HelixCorrelationPayload Include="$(CoreCLRAotSdkDir)" Condition="'$(RuntimeFlavor)' == 'coreclr'"
Destination="build/aotsdk" />
<HelixCorrelationPayload Include="$(ToolsILLinkDir)" Destination="build" />
</ItemGroup>

<ItemGroup>
<!--
We're building on Helix, so pass the zip as the app bundle path (as the bundle doesn't exist yet).
The XHarness SDK renames zip app bundle files if they're specified as the AppBundle path,
but not if they're the identity of the item. Change the item metadata such that the zip is the identity
and no app bundle is provided. -->
<_XHarnessAppBundleZipWorkItems Include="@(XHarnessAppBundleToTest->'$(MergedPayloadsRootDirectory)%(PayloadGroup).zip')" RemoveMetadata="AppBundlePath">
<CustomCommands>$(_XHarnessAppleCustomCommand)</CustomCommands>
</_XHarnessAppBundleZipWorkItems>
<!-- Replace the items. -->
<XHarnessAppBundleToTest Remove="@(XHarnessAppBundleToTest)" />
<XHarnessAppBundleToTest Include="@(_XHarnessAppBundleZipWorkItems)" />
</ItemGroup>
</Target>

<!-- Adhoc-sign createdump so we can use it in our tests -->
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(TargetOS)' == 'osx'">
<HelixPreCommands>$(HelixPreCommands);codesign -s - -f --preserve-metadata=entitlements $HELIX_CORRELATION_PAYLOAD/createdump</HelixPreCommands>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/Common/mergedrunnermobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<MainLibraryFileName>$(AssemblyName).dll</MainLibraryFileName>
<WasmMainAssemblyFileName>$(AssemblyName).dll</WasmMainAssemblyFileName>
<TestFramework>GeneratedRunner</TestFramework>
<!-- Don't treat linker warnings as errors for our tests. -->
<ILLinkTreatWarningsAsErrors>false</ILLinkTreatWarningsAsErrors>
</PropertyGroup>

<Target Name="_AddRuntimeLibsToPublishAssets" BeforeTargets="PrepareForPublish" DependsOnTargets="ResolveLibrariesRuntimeFilesFromLocalBuild;ResolveRuntimeFilesFromLocalBuild">
Expand Down Expand Up @@ -44,4 +46,4 @@
<Target Name="GenerateLocalRunnerScript" DependsOnTargets="GenerateRunScript" AfterTargets="PublishTestAsSelfContained" />

<Import Project="$(RepositoryEngineeringDir)testing\tests.targets" />
</Project>
</Project>
Loading
Loading