forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Crossgen2 cross target testing (dotnet#42663)
Add cross compilation testing for crossgen2. The goal here is to cover cross compilation for the framework libraries, with support for testing cross compilation behavior between across the large swath of possible cross target possibilities. This testing is added to the crossgen2 outerloop and is based on the work that @echesakovMSFT built for crossgen1 for cross target support for Linux X64 to Linux Arm. (The testing model has been tweaked to allow for general purpose cross target testing.) Important details. There is now a cross targeting build job, which builds (on either X64 Windows or X64 Linux) the framework dlls for a given target architecture, and captures their SHA1 hashes. Then there is a comparison job which will run crossgen2 on an arbitrary set of platforms targetting a specific OS/Architecture pair. The current state is that is known that the x86 compiler does not quite produce identical output when varied between 64 and 32 bit, there are significant issues compiling arm32 code, and arm64 code is nearly perfect with cross compilation.
- Loading branch information
1 parent
74fe95b
commit 332f118
Showing
4 changed files
with
1,366 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
eng/pipelines/coreclr/templates/crossgen2-comparison-build-job.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
parameters: | ||
buildConfig: '' | ||
archType: '' | ||
osGroup: '' | ||
osSubgroup: '' | ||
container: '' | ||
helixQueues: '' | ||
runtimeVariant: '' | ||
crossrootfsDir: '' | ||
stagedBuild: false | ||
variables: {} | ||
pool: '' | ||
|
||
# When set to a non-empty value (Debug / Release), it determines libraries | ||
# build configuration to use for the tests. Setting this property implies | ||
# a dependency of this job on the appropriate libraries build and is used | ||
# to construct the name of the Azure artifact representing libraries build | ||
# to use for building the tests. | ||
liveLibrariesBuildConfig: '' | ||
|
||
### Crossgen-comparison build job | ||
### | ||
### Ensure that the output of cross-architecture, e.g. x64-hosted-arm-targeting, | ||
### crossgen matches that of native, e.g. arm-hosted-arm-targeting, crossgen. | ||
|
||
jobs: | ||
- template: xplat-pipeline-job.yml | ||
parameters: | ||
buildConfig: ${{ parameters.buildConfig }} | ||
archType: ${{ parameters.archType }} | ||
osGroup: ${{ parameters.osGroup }} | ||
osSubgroup: ${{ parameters.osSubgroup }} | ||
stagedBuild: ${{ parameters.stagedBuild }} | ||
runtimeVariant: ${{ parameters.runtimeVariant }} | ||
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }} | ||
helixType: 'test/crossgen-comparison/' | ||
pool: ${{ parameters.pool }} | ||
|
||
# Compute job name from template parameters | ||
name: ${{ format('test_crossgen2_comparison_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} | ||
displayName: ${{ format('Test crossgen2-comparison build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} | ||
|
||
crossrootfsDir: ${{ parameters.crossrootfsDir }} | ||
|
||
variables: | ||
- ${{ if eq(variables['System.TeamProject'], 'internal') }}: | ||
- group: DotNet-HelixApi-Access | ||
- name: hostArchType | ||
value: x64 | ||
- name: targetFlavor | ||
value: $(osGroup).$(archType).$(buildConfigUpper) | ||
- name: crossFlavor | ||
value: $(osGroup).$(hostArchType)_$(archType).$(buildConfigUpper) | ||
- name: artifactsDirectory | ||
value: $(Build.SourcesDirectory)$(dir)artifacts | ||
- name: binDirectory | ||
value: $(artifactsDirectory)$(dir)bin | ||
- name: productDirectory | ||
value: $(binDirectory)$(dir)coreclr | ||
- name: workItemDirectory | ||
value: $(artifactsDirectory)$(dir)tests$(dir)coreclr$(dir)$(targetFlavor)$(dir)Tests$(dir)CrossCompileRoot | ||
- name: crossgencompare_build_artifact | ||
value: crossgen_comparison_build_$(osGroup)$(osSubgroup)_$(archType) | ||
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}: | ||
- name: target_crossgen2_os | ||
value: windows | ||
- ${{ if eq(parameters.osGroup, 'Linux') }}: | ||
- name: target_crossgen2_os | ||
value: linux | ||
- ${{ if eq(parameters.osGroup, 'OSX') }}: | ||
- name: target_crossgen2_os | ||
value: osx | ||
- name: crossgen2location | ||
value: $(productDirectory)$(dir)$(targetFlavor)$(dir)crossgen2$(dir)crossgen2.dll | ||
- ${{ if ne(parameters.archType, 'x64') }}: | ||
- name: crossgen2location | ||
value: $(productDirectory)$(dir)$(targetFlavor)$(dir)x64$(dir)crossgen2$(dir)crossgen2.dll | ||
- name: librariesProductDllDir | ||
value: $(Build.SourcesDirectory)$(dir)artifacts$(dir)bin$(dir)runtime$(dir)net5.0-$(osGroup)$(osSubgroup)-$(buildConfig)-$(archType) | ||
|
||
- ${{ parameters.variables }} | ||
|
||
# Test job depends on the corresponding build job | ||
dependsOn: | ||
- ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', 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) }} | ||
|
||
# Run all steps in the container. | ||
# Note that the containers are defined in platform-matrix.yml | ||
container: ${{ parameters.container }} | ||
timeoutInMinutes: 180 # 3 hrs | ||
|
||
steps: | ||
|
||
# Download product build | ||
- template: /eng/pipelines/common/download-artifact-step.yml | ||
parameters: | ||
unpackFolder: $(buildProductRootFolderPath) | ||
artifactFileName: '$(buildProductArtifactName)$(archiveExtension)' | ||
artifactName: '$(buildProductArtifactName)' | ||
displayName: 'product build' | ||
|
||
# Optionally download live-built libraries | ||
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}: | ||
- template: /eng/pipelines/common/download-artifact-step.yml | ||
parameters: | ||
unpackFolder: $(librariesDownloadDir) | ||
cleanUnpackFolder: false | ||
artifactFileName: '$(librariesBuildArtifactName)$(archiveExtension)' | ||
artifactName: '$(librariesBuildArtifactName)' | ||
displayName: 'live-built libraries' | ||
|
||
# Populate Core_Root | ||
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly | ||
displayName: Populate Core_Root | ||
|
||
# Create work item directory and populate with assemblies | ||
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}: | ||
- script: | | ||
mkdir -p $(workItemDirectory) | ||
mkdir -p $(workItemDirectory)/log | ||
mkdir -p $(workItemDirectory)/dlls | ||
cp $(librariesProductDllDir)/* $(workItemDirectory)/dlls | ||
cp $(productDirectory)/$(targetFlavor)/IL/System.Private.CoreLib.dll $(workItemDirectory)/dlls | ||
displayName: Create directories | ||
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}: | ||
- script: | | ||
md $(workItemDirectory)\log | ||
md $(workItemDirectory)\dlls | ||
echo copy $(librariesProductDllDir)\* $(workItemDirectory)\dlls | ||
copy $(librariesProductDllDir)\* $(workItemDirectory)\dlls | ||
echo copy $(productDirectory)\$(targetFlavor)\IL\System.Private.CoreLib.dll $(workItemDirectory)\dlls | ||
copy $(productDirectory)\$(targetFlavor)\IL\System.Private.CoreLib.dll $(workItemDirectory)\dlls | ||
displayName: Create directories | ||
|
||
# Create baseline output on the host (x64) machine | ||
- task: PythonScript@0 | ||
displayName: Create cross-platform crossgen baseline | ||
inputs: | ||
scriptSource: 'filePath' | ||
scriptPath: $(Build.SourcesDirectory)/src/tests/Common/scripts/crossgen2_comparison.py | ||
${{ if ne(parameters.osGroup, 'Windows_NT') }}: | ||
pythonInterpreter: /usr/bin/python3 | ||
arguments: | ||
crossgen_framework | ||
--crossgen $(crossgen2location) | ||
--dotnet $(Build.SourcesDirectory)/dotnet.sh | ||
--core_root $(workItemDirectory)/dlls | ||
--result_dir $(workItemDirectory)/log | ||
--target_os $(target_crossgen2_os) | ||
--target_arch $(archType) | ||
${{ if eq(parameters.osGroup, 'Windows_NT') }}: | ||
arguments: | ||
crossgen_framework | ||
--crossgen $(crossgen2location) | ||
--dotnet $(Build.SourcesDirectory)\dotnet.cmd | ||
--core_root $(workItemDirectory)\dlls | ||
--result_dir $(workItemDirectory)\log | ||
--target_os $(target_crossgen2_os) | ||
--target_arch $(archType) | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: Publish cross compiled component | ||
inputs: | ||
targetPath: $(workItemDirectory) | ||
artifactName: $(crossgencompare_build_artifact) | ||
continueOnError: true | ||
condition: always() |
Oops, something went wrong.