Skip to content

Commit a806647

Browse files
jkoritzinskytrylek
andauthored
Only build the GC simulator tests in the GC simulator leg (#68177)
* Only build the GC simulator tests in the GC simulator leg Only build the GC simluator tests instead of all Pri1 tests. When we build all Pri1 tests in this leg, nearly all tests are skipped as only the GCSimluator tests are actually run. These skipped tests leave a ton of files on disk, causing issues in Helix. By only building the actual tests we are going to run, we can avoid this additional infrastructure cost. * Harden the conditional statements against empty merged wrapper set * Filter tests during "copy native binaries" step as we also generate the run scripts in this step. * Fix indentation * Move filter arg up * No dash for tree arg in windows * Specially handle sending one assembly with PayloadGroup0 Co-authored-by: Tomas <[email protected]>
1 parent 0ae6b95 commit a806647

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

eng/pipelines/common/templates/runtimes/build-test-job.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ jobs:
9595
- name: runtimeFlavorArgs
9696
value: '-mono'
9797

98+
- name: testTreeFilterArg
99+
value: ''
100+
101+
# Only build GCSimulator tests when the gc-simulator group is specified.
102+
- ${{ if eq(parameters.testGroup, 'gc-simulator') }}:
103+
- ${{ if eq(parameters.osGroup, 'windows') }}:
104+
- name: testTreeFilterArg
105+
value: 'tree GC/Scenarios/GCSimulator'
106+
- ${{ if ne(parameters.osGroup, 'windows') }}:
107+
- name: testTreeFilterArg
108+
value: '-tree:GC/Scenarios/GCSimulator'
109+
98110
steps:
99111

100112
# Install test build dependencies
@@ -113,7 +125,7 @@ jobs:
113125
displayName: Disk Usage before Build
114126
115127
# Build managed test components
116-
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)Managed allTargets skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(runtimeFlavorArgs) $(crossArg) $(priorityArg) ci /p:TargetOS=AnyOS
128+
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)Managed allTargets skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(runtimeFlavorArgs) $(crossArg) $(priorityArg) $(testTreeFilterArg) ci /p:TargetOS=AnyOS
117129
displayName: Build managed test components
118130

119131
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:

eng/pipelines/common/templates/runtimes/run-test-job.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ jobs:
134134
- name: LogNamePrefix
135135
value: TestRunLogs_R2R_CG2_Composite
136136

137+
- name: testTreeFilterArg
138+
value: ''
139+
140+
# Only build GCSimulator tests when the gc-simulator group is specified.
141+
- ${{ if eq(parameters.testGroup, 'gc-simulator') }}:
142+
- ${{ if eq(parameters.osGroup, 'windows') }}:
143+
- name: testTreeFilterArg
144+
value: 'tree GC/Scenarios/GCSimulator'
145+
- ${{ if ne(parameters.osGroup, 'windows') }}:
146+
- name: testTreeFilterArg
147+
value: '-tree:GC/Scenarios/GCSimulator'
148+
137149
# Set job timeouts
138150
#
139151
# "timeoutPerTestCollectionInMinutes" is the time needed for the "biggest" xUnit test collection to complete.
@@ -287,7 +299,7 @@ jobs:
287299
# and directly unzip them there after download). Unfortunately the logic to copy
288300
# the native artifacts to the final test folders is dependent on availability of the
289301
# managed test artifacts.
290-
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) copynativeonly $(logRootNameArg)Native $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(priorityArg) $(librariesOverrideArg)
302+
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) copynativeonly $(logRootNameArg)Native $(testTreeFilterArg) $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(priorityArg) $(librariesOverrideArg)
291303
displayName: Copy native test components to test output folder
292304

293305

src/tests/Common/helixpublishwitharcade.proj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,21 +307,21 @@
307307
Condition="'@(_MergedWrapperOutOfProcessTestMarkers)' != ''" />
308308
</ItemGroup>
309309

310-
<ItemGroup>
310+
<ItemGroup Condition="'@(_MergedWrapperMarker)' != ''" >
311311
<_MergedPayloadGroups Include="$(_MergedWrapperName)" />
312312
<_MergedPayloadFiles Include="$(_MergedWrapperDirectory)/**" />
313313
<_MergedPayloadFiles Include="@(_MergedWrapperOutOfProcessTestFiles)" />
314-
<_MergedPayloadFiles Update="@(_MergedPayloadFiles)">
314+
<_MergedPayloadFiles Update="@(_MergedPayloadFiles)" Condition="'@(_MergedPayloadFiles)' != ''" >
315315
<!-- Never use [MSBuild]::MakeRelative here! We have some files containing Unicode characters in their %(FullPath) and
316316
MakeRelative function calls Escape function internally that replaces all the Unicode characters with %<xx>. -->
317317
<FileRelativeToPayloadsRootDirectory>$([System.IO.Path]::GetRelativePath($(TestBinDir), %(FullPath)))</FileRelativeToPayloadsRootDirectory>
318318
</_MergedPayloadFiles>
319319
</ItemGroup>
320320

321-
<ItemGroup>
321+
<ItemGroup Condition="'@(_MergedPayloadFiles)' != ''" >
322322
<!-- Remove the managed pdbs from our payloads.
323323
This is for performance reasons to reduce our helix payload size -->
324-
<ReducedMergedPayloadFilesFinal Include="@(_MergedPayloadFiles)" Condition=" '%(Extension)' != '.pdb' and '%(Extension)' != '.OutOfProcessTest' " />
324+
<ReducedMergedPayloadFilesFinal Include="@(_MergedPayloadFiles)" Condition=" '%(Extension)' != '.pdb' and '%(Extension)' != '.OutOfProcessTest'" />
325325
</ItemGroup>
326326

327327
<ItemGroup>
@@ -332,7 +332,7 @@
332332
<HelixCommandLines Condition="'$(RuntimeVariant)' != 'llvmfullaot'" Include="$(_MergedWrapperRunScriptRelative)" />
333333
</ItemGroup>
334334

335-
<Copy SourceFiles="@(ReducedMergedPayloadFilesFinal)" DestinationFiles="@(ReducedMergedPayloadFilesFinal->'$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\%(FileRelativeToPayloadsRootDirectory)')" />
335+
<Copy SourceFiles="@(ReducedMergedPayloadFilesFinal)" DestinationFiles="@(ReducedMergedPayloadFilesFinal->'$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\%(FileRelativeToPayloadsRootDirectory)')" Condition="'@(ReducedMergedPayloadFilesFinal)' != ''" />
336336
<WriteLinesToFile File="$(MergedPayloadsRootDirectory)\$(_MergedWrapperName)\HelixCommand.txt" Lines="@(HelixCommandLines)" />
337337
</Target>
338338

@@ -577,9 +577,15 @@
577577
<XUnitWrapperDlls>$([System.String]::Join(' ', $([System.IO.Directory]::GetFiles(%(FullPath), '*.XUnitWrapper.dll', SearchOption.AllDirectories))).Replace($([MSBuild]::EnsureTrailingSlash(%(FullPath))),''))</XUnitWrapperDlls>
578578
</LegacyPayloads>
579579
<LegacyPayloads Update="@(LegacyPayloads)">
580+
<!-- Specify the test group from the payload name. For explicitly named groups, PayloadGroup specifies the subset of tests we want to run in this Helix Work Item -->
580581
<TestGroup>%(PayloadGroup)</TestGroup>
581-
<!-- When Payload contains more than one *.XUnitWrapper.dll TestGroup should not be specified. -->
582+
<!-- When Payload contains more than one *.XUnitWrapper.dll TestGroup should not be specified. When we specify multiple assemblies, we aren't trying to run only a subset of tests within one assembly. -->
582583
<TestGroup Condition=" $([MSBuild]::ValueOrDefault(%(XUnitWrapperDlls), '').IndexOf('.XUnitWrapper.dll')) != $([MSBuild]::ValueOrDefault(%(XUnitWrapperDlls), '').LastIndexOf('.XUnitWrapper.dll')) "></TestGroup>
584+
<!--
585+
PayloadGroup0 is just a synthesized name for a bundle of multiple test assemblies that we send as one payload.
586+
Normally the condition above catches this case; however, when we're only sending one assembly, passing PayloadGroup0 to Helix means that no tests will be run.
587+
-->
588+
<TestGroup Condition="'%(PayloadGroup)' == 'PayloadGroup0'"></TestGroup>
583589
<PayloadZipFile>$(LegacyPayloadsRootDirectory)\%(PayloadGroup).zip</PayloadZipFile>
584590
</LegacyPayloads>
585591
</ItemGroup>

0 commit comments

Comments
 (0)