Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sendtohelix.proj « libraries « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6dff5f9b455f77d3ffbb08622a81eba038a13c1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!-- This project constructs the Helix "correlation payload", the set of files needed to run a set of tests,
     and then invokes sendtohelixhelp.proj for each test assembly and scenario combination to get Helix to
     invoke the tests.

     In the simple case, no scenarios are specified and the default CoreCLR optimization configuration
     is used to run the tests. If a set of comma-separated scenarios are specified in the `_Scenarios`
     property, then each test is run for each of the specified CoreCLR scenarios (e.g., COMPlus_JitStress=1;
     COMPlus_JitStressRegs=4; COMPlus_JitStress=2 + COMPlus_JitStressRegs=0x1000). The set of acceptable
     scenario names is defined and interpreted by src\tests\Common\testenvironment.proj.

    "RunInParallelForEachScenario" is the "root" target for this Project. It first creates the
    "correlation payload", which is the set of files used by all Helix submissions
    (which we compress into a single file).
-->
<Project Sdk="Microsoft.Build.NoTargets" InitialTargets="_SetTestArchiveRuntimeFile">

  <PropertyGroup>
    <BuildTargetFramework Condition="'$(BuildTargetFramework)' == ''">$(NetCoreAppCurrent)</BuildTargetFramework>
    <TargetsWindows Condition="'$(TargetOS)' == 'windows'">true</TargetsWindows>

    <!-- Set the name of the scenario file. Note that this is only used in invocations where $(Scenario) is set
         (which is when this project is invoked to call the "CreateOneScenarioTestEnvFile" target). -->
    <TestEnvFileName Condition=" '$(TargetsWindows)' == 'true' ">SetStressModes_$(Scenario).cmd</TestEnvFileName>
    <TestEnvFileName Condition=" '$(TargetsWindows)' != 'true' ">SetStressModes_$(Scenario).sh</TestEnvFileName>

  </PropertyGroup>
  
  <!-- The Helix correlation payload file -->
  <Target Name="_SetTestArchiveRuntimeFile"
          Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">
    <PropertyGroup>
      <TestArchiveRuntimeFile>$(TestArchiveRuntimeRoot)test-runtime-$(NetCoreAppCurrentBuildSettings).zip</TestArchiveRuntimeFile>
    </PropertyGroup>
  </Target>

  <Target Name="RunInParallelForEachScenario"
          AfterTargets="Build">
    <PropertyGroup>
      <!-- This specifies what properties are needed to be passed down as global properties to a child project invocation. -->
      <_PropertiesToPass>
        RuntimeFlavor=$(RuntimeFlavor);
        TargetArchitecture=$(TargetArchitecture);
        Configuration=$(Configuration);
        TargetOS=$(TargetOS);
        TargetRuntimeIdentifier=$(TargetRuntimeIdentifier);
        TestRunNamePrefixSuffix=$(TestRunNamePrefixSuffix);
        Creator=$(Creator);
        HelixAccessToken=$(HelixAccessToken);
        HelixTargetQueues=$(HelixTargetQueues);
        BuildTargetFramework=$(BuildTargetFramework)
      </_PropertiesToPass>
    </PropertyGroup>

    <Message Condition="'$(_Scenarios)' != ''" Importance="High" Text="Using _Scenarios: $(_Scenarios)" />
    <Message Importance="High" Text="Using Queues: $(HelixTargetQueues)" />
    <Message Importance="High" Text="BuildTargetFramework: $(BuildTargetFramework)" />
    <Message Importance="High" Text="TestArchiveTestsRoot: $(TestArchiveTestsRoot)" />
    <Message Importance="High" Text="TestArchiveRoot: $(TestArchiveRoot)" />
    <Message Importance="High" Text="TestArchiveRuntimeRoot: $(TestArchiveRuntimeRoot)" />
    <Message Condition="'$(TestArchiveRuntimeFile)' != ''" Importance="High" Text="TestArchiveRuntimeFile: $(TestArchiveRuntimeFile)" />

    <!-- Re-invoke MSBuild on this project to create the correlation payload -->
    <MSBuild Projects="$(MSBuildProjectFile)" Targets="PrepareCorrelationPayloadDirectory" Properties="Scenarios=$(_Scenarios)" />

    <PropertyGroup>
      <PerScenarioProjectFile>$(MSBuildThisFileDirectory)sendtohelixhelp.proj</PerScenarioProjectFile>
    </PropertyGroup>

    <ItemGroup>
      <_Scenarios Include="$(_Scenarios.Split(','))" />

      <!-- MSBuild creates a new instance of the project for each %(_Scenarios.Identity) and can build them in parallel. -->
      <_ProjectsToBuild Include="$(PerScenarioProjectFile)">
        <AdditionalProperties>$(_PropertiesToPass);Scenario=%(_Scenarios.Identity);TestArchiveRuntimeFile=$(TestArchiveRuntimeFile)</AdditionalProperties>
        <AdditionalProperties Condition="'$(NeedsToBuildWasmAppsOnHelix)' != ''">%(_ProjectsToBuild.AdditionalProperties);NeedsToBuildWasmAppsOnHelix=$(NeedsToBuildWasmAppsOnHelix)</AdditionalProperties>
      </_ProjectsToBuild>
    </ItemGroup>

    <PropertyGroup>
      <_BuildInParallel>false</_BuildInParallel>
      <_BuildInParallel Condition=" '@(_ProjectsToBuild->Count())' &gt; '1' ">true</_BuildInParallel>
    </PropertyGroup>

    <!-- Invoke MSBuild once for each Scenario (because of the "batching" defined in "_ProjectsToBuild").
         Create the Helix work items and start the jobs. This is done by invoking the "Test" Helix target.
    -->
    <MSBuild Projects="@(_ProjectsToBuild)" Targets="Test" BuildInParallel="$(_BuildInParallel)" StopOnFirstFailure="false" />
  </Target>

  <Target Name="CreateOneScenarioTestEnvFile">
    <!-- This target creates one __TestEnv file for the single $(Scenario). -->
    <Error Condition="'$(Scenario)' == ''" Text="No Scenario specified" />

    <PropertyGroup>
      <TestEnvFilePath>$(NetCoreAppCurrentTestHostPath)$(TestEnvFileName)</TestEnvFilePath>
    </PropertyGroup>

    <ItemGroup>
      <_ProjectsToBuild Include="$(RepoRoot)\src\tests\Common\testenvironment.proj">
        <Properties>Scenario=$(Scenario);TestEnvFileName=$(TestEnvFilePath);TargetsWindows=$(TargetsWindows)</Properties>
      </_ProjectsToBuild>
    </ItemGroup>

    <Message Importance="High" Text="Creating $(TestEnvFilePath) for scenario $(Scenario)" />

    <MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateTestEnvFile" StopOnFirstFailure="true" />

    <Error Condition="!Exists('$(TestEnvFilePath)')" Text="File $(TestEnvFilePath) not found!" />
  </Target>

  <Target Condition="'$(Scenarios)' != '' and '$(TargetOS)' != 'Browser'" Name="CreateAllScenarioTestEnvFiles">
    <!-- This target creates one __TestEnv file for each of the scenarios in the $(Scenarios) comma-separated list. -->

    <Message Importance="High" Text="Creating per-scenario TestEnv files for scenarios $(Scenarios)" />

    <ItemGroup>
      <_Scenario Include="$(Scenarios.Split(','))" />
      <_ProjectsToBuild Include="$(MSBuildProjectFile)">
        <AdditionalProperties>Scenario=%(_Scenario.Identity)</AdditionalProperties>
      </_ProjectsToBuild>
    </ItemGroup>

    <MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true" />
  </Target>

  <Target Name="_CollectRuntimeInputs">
    <!--
      We need to include all dlls in the runtime path as inputs to make it really incremental. If we use the root folder,
      if a dll is updated, the folder's timestamp is not updated, therefore skipped.
    -->
    <ItemGroup>
      <_RuntimeInput Include="$(NetCoreAppCurrentTestHostPath)**\*.dll" />

      <!-- Add the scenario TestEnv batch files -->
      <_RuntimeInput Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' == 'true' " Include="$(NetCoreAppCurrentTestHostPath)**\*.cmd" />
      <_RuntimeInput Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' != 'true' " Include="$(NetCoreAppCurrentTestHostPath)**\*.sh" />
    </ItemGroup>
  </Target>

  <Target Name="IncludeDumpDocsInTesthost"
          Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
    <ItemGroup>
      <DebugDocsFiles Include="$(RepositoryEngineeringDir)testing\debug-dump-template.md" />
      <DebugDocsFiles Include="$(RepositoryEngineeringDir)testing\gen-debug-dump-docs.py" />

      <_RuntimeInputs Include="@(DebugDocsFiles)" />
    </ItemGroup>

    <Copy SourceFiles="@(DebugDocsFiles)"
          DestinationFolder="$(NetCoreAppCurrentTestHostPath)"
          SkipUnchangedFiles="true" />
  </Target>

  <Target Name="CompressRuntimeDirectory"
          DependsOnTargets="IncludeDumpDocsInTesthost;_CollectRuntimeInputs"
          Inputs="@(_RuntimeInput);@(TestArchiveRuntimeDependency)"
          Outputs="$(TestArchiveRuntimeFile)"
          Condition="'$(TargetsMobile)' != 'true' and
                     '$(TestArchiveRuntimeFile)' != ''">
    <!-- Compress the test files, testhost, and per-scenario scripts into a single ZIP file for sending to the Helix machines. -->

    <Message Importance="High" Text="Compressing runtime directory" />

    <Message Importance="High" Text="Creating directory $(TestArchiveRuntimeRoot)" />
    <MakeDir Directories="$(TestArchiveRuntimeRoot)" />

    <ZipDirectory SourceDirectory="$(NetCoreAppCurrentTestHostPath)"
                  DestinationFile="$(TestArchiveRuntimeFile)"
                  Overwrite="true" />
  </Target>

  <!--
    Collect all the tasks needed to be run once, to prepare the Helix correlation payload directory.
    There's no actual work here; this target just causes its dependent targets to be run.
  -->
  <Target Name="PrepareCorrelationPayloadDirectory"
          DependsOnTargets="CreateAllScenarioTestEnvFiles;CompressRuntimeDirectory" >
    <Message Importance="High" Text="Correlation directory prepared" />
  </Target>

</Project>