cross-crossgen job, reduce workitem size (#33436)
authorJarret Shook <jashoo@microsoft.com>
Wed, 11 Mar 2020 18:11:44 +0000 (11:11 -0700)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 18:11:44 +0000 (11:11 -0700)
* cross-crossgen job, reduce workitem size

* Fix yml authoring error

* Fix typo and add validation to corelib location

* Print run time

eng/pipelines/coreclr/templates/crossgen-comparison-job.yml
src/coreclr/tests/scripts/crossgen_comparison.py

index 7f5798367a93743028a7a98d801253e0ff46b8b8..15e4241ee434b71a2158c56a9bfa50dc7b7626ea 100644 (file)
@@ -56,6 +56,8 @@ jobs:
         value: $(artifactsDirectory)/bin
       - name: productDirectory
         value: $(binDirectory)/coreclr
+      - name: workItemDirectory
+        value: $(artifactsDirectory)/cross-crossgen
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       - name: artifactsDirectory
         value: $(Build.SourcesDirectory)\artifacts
@@ -63,6 +65,8 @@ jobs:
         value: $(artifactsDirectory)\bin
       - name: productDirectory
         value: $(binDirectory)\coreclr
+      - name: workItemDirectory
+        value: $(artifactsDirectory)\cross-crossgen
 
     - ${{ parameters.variables }}
 
@@ -102,11 +106,11 @@ jobs:
     - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
       - script: |
           chmod +x $(productDirectory)/$(targetFlavor)/$(hostArchType)/crossgen
-          mkdir -p $(artifactsDirectory)/log/$(crossFlavor)
+          mkdir -p $(workItemDirectory)/log/$(crossFlavor)
         displayName: Create directories and ensure crossgen is executable
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       - script: |
-          mkdir $(artifactsDirectory)\log\$(crossFlavor)
+          mkdir $(workItemDirectory)\log\$(crossFlavor)
         displayName: Create directories
 
 
@@ -114,6 +118,17 @@ jobs:
     - script: $(coreClrRepoRootDir)build-test$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly
       displayName: Populate Core_Root
 
+    # Populate the workitem directory
+    - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
+      - script: |
+          cp -r $(artifactsDirectory)/tests/coreclr/$(targetFlavor)/Tests/Core_Root $(workItemDirectory)/Core_Root
+        displayName: Populate the workitem directory
+    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
+      - script: |
+          mkdir $(workItemDirectory)\Core_Root
+          xcopy /s $(artifactsDirectory)\tests\coreclr\$(targetFlavor)\Tests\Core_Root $(workItemDirectory)\Core_Root
+        displayName: Populate the workitem directory
+
 
     # Create baseline output on the host (x64) machine
     - task: PythonScript@0
@@ -127,14 +142,14 @@ jobs:
             --crossgen   $(productDirectory)/$(targetFlavor)/$(hostArchType)/crossgen
             --il_corelib $(productDirectory)/$(targetFlavor)/IL/System.Private.CoreLib.dll
             --core_root  $(artifactsDirectory)/tests/coreclr/$(targetFlavor)/Tests/Core_Root
-            --result_dir $(artifactsDirectory)/log/$(crossFlavor)
+            --result_dir $(workItemDirectory)/log/$(crossFlavor)
         ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
           arguments:
             crossgen_framework
             --crossgen   $(productDirectory)\$(targetFlavor)\$(hostArchType)\crossgen
             --il_corelib $(productDirectory)\$(targetFlavor)\IL\System.Private.CoreLib.dll
             --core_root  $(artifactsDirectory)\tests\coreclr\$(targetFlavor)\Tests\Core_Root
-            --result_dir $(artifactsDirectory)\log\$(crossFlavor)
+            --result_dir $(workItemDirectory)\log\$(crossFlavor)
 
 
     # Send payload to Helix where the native output is generated and compared to the baseline
@@ -149,16 +164,16 @@ jobs:
         ${{ if ne(variables['System.TeamProject'], 'internal') }}:
           Creator: $(Creator)
         WorkItemTimeout: 3:00 # 3 hours
-        WorkItemDirectory: '$(artifactsDirectory)'
+        WorkItemDirectory: '$(workItemDirectory)'
         CorrelationPayloadDirectory: '$(coreClrRepoRoot)/tests/scripts'
         ${{ if ne(parameters.osName, 'Windows_NT') }}:
           WorkItemCommand:
-            chmod +x     $HELIX_WORKITEM_PAYLOAD/bin/coreclr/$(targetFlavor)/crossgen;
+            chmod +x     $HELIX_WORKITEM_PAYLOAD/Core_Root/crossgen;
             mkdir -p     $HELIX_WORKITEM_PAYLOAD/log/$(targetFlavor);
             python -u $HELIX_CORRELATION_PAYLOAD/crossgen_comparison.py crossgen_framework
-            --crossgen   $HELIX_WORKITEM_PAYLOAD/bin/coreclr/$(targetFlavor)/crossgen
-            --il_corelib $HELIX_WORKITEM_PAYLOAD/bin/coreclr/$(targetFlavor)/IL/System.Private.CoreLib.dll
-            --core_root  $HELIX_WORKITEM_PAYLOAD/tests/coreclr/$(targetFlavor)/Tests/Core_Root
+            --crossgen   $HELIX_WORKITEM_PAYLOAD/Core_Root/crossgen
+            --il_corelib $HELIX_WORKITEM_PAYLOAD/Core_Root/IL/System.Private.CoreLib.dll
+            --core_root  $HELIX_WORKITEM_PAYLOAD/Core_Root
             --result_dir $HELIX_WORKITEM_PAYLOAD/log/$(targetFlavor);
             python -u $HELIX_CORRELATION_PAYLOAD/crossgen_comparison.py compare
             --base_dir   $HELIX_WORKITEM_PAYLOAD/log/$(crossFlavor)
@@ -167,9 +182,9 @@ jobs:
           WorkItemCommand:
             mkdir        %HELIX_WORKITEM_PAYLOAD%\log\$(targetFlavor);
             python -u %HELIX_CORRELATION_PAYLOAD%\crossgen_comparison.py crossgen_framework
-            --crossgen   %HELIX_WORKITEM_PAYLOAD%\bin\coreclr\$(targetFlavor)\crossgen
-            --il_corelib %HELIX_WORKITEM_PAYLOAD%\bin\coreclr\$(targetFlavor)\IL\System.Private.CoreLib.dll
-            --core_root  %HELIX_WORKITEM_PAYLOAD%\tests\coreclr\$(targetFlavor)\Tests\Core_Root
+            --crossgen   %HELIX_WORKITEM_PAYLOAD%\Core_Root\crossgen
+            --il_corelib %HELIX_WORKITEM_PAYLOAD%\Core_Root\IL\System.Private.CoreLib.dll
+            --core_root  %HELIX_WORKITEM_PAYLOAD%\Core_Root
             --result_dir %HELIX_WORKITEM_PAYLOAD%\log\$(targetFlavor);
             python -u %HELIX_CORRELATION_PAYLOAD%\crossgen_comparison.py compare
             --base_dir   %HELIX_WORKITEM_PAYLOAD%\log\$(crossFlavor)
@@ -179,7 +194,7 @@ jobs:
     - task: PublishPipelineArtifact@1
       displayName: Publish log
       inputs:
-        pathtoPublish: $(artifactsDirectory)/log
+        pathtoPublish: $(workItemDirectory)/log
         artifactName: ${{ format('Testlog_crossgen_comparison_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
       continueOnError: true
       condition: always()
index 82a7bc7be6f4b004cb885d8f0b961d021a54fe20..96ced35650d6419371fd19d9aa54e8fe3cd240a3 100644 (file)
@@ -92,6 +92,7 @@
 ################################################################################
 
 import argparse
+import datetime
 import glob
 import json
 import hashlib
@@ -526,6 +527,12 @@ def crossgen_corelib(args):
     ni_corelib_dirname, debugging_files_dirname = create_output_folders()
     ni_corelib_filename = os.path.join(ni_corelib_dirname, assembly_name)
     platform_assemblies_paths = [os.path.dirname(il_corelib_filename)]
+
+    # Validate the paths are correct.
+    if not os.path.exists(il_corelib_filename):
+        print("IL Corelib path does not exist.")
+        sys.exit(1)
+
     crossgen_results = run_crossgen(args.crossgen_executable_filename, il_corelib_filename, ni_corelib_filename, platform_assemblies_paths, debugging_files_dirname)
     shutil.rmtree(ni_corelib_dirname, ignore_errors=True)
     save_crossgen_results_to_json_files(crossgen_results, args.result_dirname)
@@ -688,6 +695,13 @@ def compare_results(args):
 ################################################################################
 
 if __name__ == '__main__':
+    start = datetime.datetime.now()
+
     parser = build_argument_parser()
     args = parser.parse_args()
     func = args.func(args)
+
+    end = datetime.datetime.now()
+    elapsed = end - start
+
+    print("Elapsed time: {}".format(elapsed.total_seconds()))
\ No newline at end of file