Skip to content

Commit 5ff4fdd

Browse files
Adjust determinism tests to store away the 2 different binaries that are generated (#87852)
- This should allow comparison without needing full rebuilds - as well as comparison in cases where locally running the tooling doesn't result in equivalent results - In addition, generate a map file to better understand what portion of the two files does not match Finally, fix comparison failure identified by using the above tech: - Fix culture sensive compare in instruction set handling - This should be culture insensitive, as otherwise different machines can reliably generate different output due to different culture settings
1 parent 73f96e6 commit 5ff4fdd

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ jobs:
149149
--crossgen $HELIX_WORKITEM_PAYLOAD/crossgen2/crossgen2.dll
150150
--dotnet $HELIX_WORKITEM_PAYLOAD/corerun
151151
--core_root $HELIX_WORKITEM_PAYLOAD/prebuiltWork/dlls
152-
--result_dir $HELIX_WORKITEM_PAYLOAD/log
152+
--result_dir $HELIX_WORKITEM_UPLOAD_ROOT
153153
--target_os $(target_crossgen2_os)
154154
--target_arch $(targetarch)
155155
--compiler_arch_os $(compiler_arch_os);
156156
python3 -u $HELIX_CORRELATION_PAYLOAD/crossgen2_comparison.py compare
157157
--base_dir $HELIX_WORKITEM_PAYLOAD/prebuiltWork/log
158-
--diff_dir $HELIX_WORKITEM_PAYLOAD/log
158+
--diff_dir $HELIX_WORKITEM_UPLOAD_ROOT
159159
--testresults $HELIX_WORKITEM_ROOT/testResults.xml
160160
--target_arch_os $(target_crossgen2_os)_$(targetarch)
161161
${{ if eq(parameters.osGroup, 'windows') }}:
@@ -168,13 +168,13 @@ jobs:
168168
--crossgen %HELIX_WORKITEM_PAYLOAD%\crossgen2\crossgen2.dll
169169
--dotnet %HELIX_WORKITEM_PAYLOAD%\corerun.exe
170170
--core_root %HELIX_WORKITEM_PAYLOAD%\prebuiltWork\dlls
171-
--result_dir %HELIX_WORKITEM_PAYLOAD%\log
171+
--result_dir %HELIX_WORKITEM_UPLOAD_ROOT%
172172
--target_os $(target_crossgen2_os)
173173
--target_arch $(targetarch)
174174
--compiler_arch_os $(compiler_arch_os) &
175175
python -u %HELIX_CORRELATION_PAYLOAD%\crossgen2_comparison.py compare
176176
--base_dir %HELIX_WORKITEM_PAYLOAD%\prebuiltWork\log
177-
--diff_dir %HELIX_WORKITEM_PAYLOAD%\log
177+
--diff_dir %HELIX_WORKITEM_UPLOAD_ROOT%
178178
--testresults %HELIX_WORKITEM_ROOT%\testResults.xml
179179
--target_arch_os $(target_crossgen2_os)_$(targetarch)
180180
# Publish log

src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ReadyToRunInstructionSetSupportSignature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilde
113113

114114
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer)
115115
{
116-
return _instructionSetsSupport.CompareTo(((ReadyToRunInstructionSetSupportSignature)other)._instructionSetsSupport);
116+
return string.CompareOrdinal(_instructionSetsSupport, ((ReadyToRunInstructionSetSupportSignature)other)._instructionSetsSupport);
117117
}
118118
}
119119
}

src/tests/Common/scripts/crossgen2_comparison.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ def _build_args_crossgen_il_file(self, il_filename, ni_filename, platform_assemb
529529
args.append('"' + platform_assemblies_paths + self.platform_directory_sep + '*.dll"' )
530530
args.append('-O')
531531
args.append('--determinism-stress')
532-
args.append('3')
532+
args.append('6')
533+
args.append('--map')
533534
args.append('--out')
534535
args.append(ni_filename)
535536
args.append('--targetos ')
@@ -720,6 +721,7 @@ def add_ni_extension(filename):
720721

721722
def crossgen_framework(args):
722723
ni_files_dirname, debugging_files_dirname = create_output_folders()
724+
ni_files_dirname = args.result_dirname
723725

724726
async def run_crossgen_helper(print_prefix, assembly_name):
725727
global g_frameworkcompile_failed
@@ -737,7 +739,6 @@ async def run_crossgen_helper(print_prefix, assembly_name):
737739
helper = AsyncSubprocessHelper(g_Framework_Assemblies, verbose=True)
738740
helper.run_to_completion(run_crossgen_helper)
739741

740-
shutil.rmtree(ni_files_dirname, ignore_errors=True)
741742
if g_frameworkcompile_failed:
742743
sys.exit(1)
743744

@@ -955,7 +956,7 @@ def compare_results(args):
955956

956957
base_result_string = json.dumps(base_result, cls=CrossGenResultEncoder, indent=2)
957958
diff_result_string = json.dumps(diff_result, cls=CrossGenResultEncoder, indent=2)
958-
message = 'Expected {0} got {1}'.format(base_result_string, diff_result_string)
959+
message = 'Expected {0} got {1} Attached to this helix job will be the binary produced during the helix run and you can find the binary to compare to in the artifacts for the pipeline.'.format(base_result_string, diff_result_string)
959960
testresult = root.createElement('test')
960961
testresult.setAttribute('name', 'CrossgenCompile_{3}_Target_{0}_{1}_vs_{2}'.format(args.target_arch_os, base_result.compiler_arch_os, diff_result.compiler_arch_os, assembly_name))
961962
testresult.setAttribute('type', 'Target_{0}'.format(args.target_arch_os))

0 commit comments

Comments
 (0)