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

upload-tests.proj « src - github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b12dea43ce4b31af632981822af11d409d1a117 (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
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
  <!-- CoreFX-Specific Helix test submission project.
       TODOS:
         - Add support for storing test-project-specific timeouts, use this instead of default if available
  -->

  <UsingTask TaskName="SimulateHelixExecution"     AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
  <UsingTask TaskName="ZipFileCreateFromDirectory" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>

  <PropertyGroup>
    <!-- Workaround for dealing with building on Linux/OSX.  
         It doesn't seem possible to pass a connection string on the command line, as it contains ';' characters. 
         Checking for the existence of a connection string will happen inside CloudTest.Helix.targets -->
    <CloudDropConnectionString    Condition="'$(CloudDropConnectionString)'==''"   >DefaultEndpointsProtocol=https;AccountName=$(CloudDropAccountName);AccountKey=$(CloudDropAccessToken);EndpointSuffix=core.windows.net</CloudDropConnectionString>
    <CloudResultsConnectionString Condition="'$(CloudResultsConnectionString)'==''">DefaultEndpointsProtocol=https;AccountName=$(CloudResultsAccountName);AccountKey=$(CloudResultsAccessToken);EndpointSuffix=core.windows.net</CloudResultsConnectionString>

    <!-- Set this to true to simulate Helix execution.  Will fail if Python 2.7.X is unavailable 
         We'll also opportunistically set SkipSendToHelix true here, since if the user is doing 
         local execution they likely don't want to run in the cloud. -->
    <LocalHelixExecution>false</LocalHelixExecution>
    <SkipSendToHelix Condition="'$(LocalHelixExecution)'=='true'">true</SkipSendToHelix>

    <!-- Indicates that commands will use ScriptRunner.py.  This requires:
         - Command must produce testResults.xml on successful execution.
         - Command is expressed in terms of an .SH file if on *Nix -->
    <UseScriptRunner>true</UseScriptRunner>
    <!-- For Windows ARM & ARM64 UAPAOT runs, we'll need a special runner that knows how to do this (TODO: Combine the runners) -->
    <UseContinuationRunner Condition="'$(ArchGroup)'=='arm' AND '$(TargetGroup)'=='uapaot'">true</UseContinuationRunner>
    <SecondaryPayloadDir   Condition="'$(ArchGroup)'=='arm' AND '$(TargetGroup)'=='uapaot'">%HELIX_WORKITEM_PAYLOAD%\native</SecondaryPayloadDir>

    <!-- Test builds consist of the tests that are platform specific in one root, plus others in AnyOS. -->
    <AnyOSPlatformConfig>AnyOS.AnyCPU.$(ConfigurationGroup)</AnyOSPlatformConfig>
    <AnyOsArchivesRoot>$(TestWorkingDir)$(AnyOSPlatformConfig)/archive/</AnyOsArchivesRoot>
    <AnyOSTestArchivesRoot>$(AnyOsArchivesRoot)tests/</AnyOSTestArchivesRoot>

    <!-- Additionally, *NIX variations may need to include their own root folders -->
    <UnixPlatformConfig>Unix.$(Platform).$(ConfigurationGroup)</UnixPlatformConfig>
    <UnixArchivesRoot>$(TestWorkingDir)$(UnixPlatformConfig)/archive/</UnixArchivesRoot>
    <UnixTestArchivesRoot>$(UnixArchivesRoot)tests/</UnixTestArchivesRoot>

    <!-- Finally, these archives represent the zips of tests that are OSPlatform specific 
         This is used by CloudTest.Helix.Targets to generate relative blob paths for archives. -->
    <ArchivesRoot>$(TestWorkingDir)$(OSPlatformConfig)/archive/</ArchivesRoot>
    <TestArchivesRoot>$(ArchivesRoot)tests/</TestArchivesRoot>

    <!-- test-runtime-*.zip is the new-for-.NET-Core-2.0 way to pass along the runtime  -->
    <TestRuntimeArchiveFilename>test-runtime-$(BuildConfiguration).zip</TestRuntimeArchiveFilename>
    <TestRuntimeArchiveFile>$(ArchivesRoot)$(TestRuntimeArchiveFilename)</TestRuntimeArchiveFile>

    <RunnerScript Condition="'$(RunnerScript)' == ''">$(TestRunnerScript)</RunnerScript>
    <SupplementalPayloadDir Condition="'$(SupplementalPayloadDir)' == ''">$(TestWorkingDir)SupplementalPayload/</SupplementalPayloadDir>

    <!-- The old CloudTest.targets forced a single timeout value onto every test -->
    <!-- Possible TODO: With the CloudTest.Helix.targets refactor, we have the ability to specify variable timeout-->
    <TimeoutInSeconds Condition="'$(TimeoutInSeconds)' == ''">600</TimeoutInSeconds>

    <!-- Set required properties for Helix Submission -->
    <IsOfficial Condition="'$(OfficialBuildId)'!=''">true</IsOfficial>
    <CurrentDate>$([System.DateTime]::Now.ToString(yyyyMMdd.mmss))</CurrentDate>

    <HelixJobType Condition="'$(HelixJobType)'==''">test/functional/cli/</HelixJobType>

    <HelixSource Condition="'$(HelixSource)'=='' And '$(IsOfficial)'!='' And '$(TestProduct)'!='' And '$(Branch)'!=''">official/$(TestProduct)/$(Branch)/</HelixSource>
    <HelixSource Condition="'$(HelixSource)'=='' And '$(IsOfficial)'=='' And '$(TestProduct)'!='' And '$(Branch)'!=''">pr/$(TestProduct)/$(Branch)/</HelixSource>
    <HelixSource Condition="'$(HelixSource)'==''">pr/unknown/</HelixSource>

    <!-- Local path for storing submission-related files -->
    <HelixLogFolder>$(ArchivesRoot)</HelixLogFolder>

    <!-- Properties used for submission by CloudTest.Helix.Targets-->
    <BuildMoniker>$(CurrentDate)</BuildMoniker>
    <BuildMoniker Condition="'$(IsOfficial)'=='true'">$(OfficialBuildId)</BuildMoniker>
    <HelixArchLabel>$(ArchGroup)</HelixArchLabel>
    <HelixConfigLabel>$(ConfigurationGroup)</HelixConfigLabel>
  </PropertyGroup>

  <Target Name="CoreFXPreCloudBuild" >
    <!-- Put anything you want to do before submitting the general purpose helix job here.
         Helix requires properly formatted work items and accessible zip files / others to upload, which we'll construct here. -->

    <!-- Gather the test archives for this build 
         If you change binplacing behavior and official runs break, 
         this is a good place to check.-->
    <Message Text="Using OS-Specific test archives from: $(TestArchivesRoot)" />
    <Message Text="Using AnyOS test archives from: $(AnyOSTestArchivesRoot)" />
    <Message Condition="'$(TargetsUnix)' == 'true'"  Text="Using Unix test archives from: $(UnixTestArchivesRoot)" />
    <ItemGroup>
      <HelixWorkItem Include="$(TestArchivesRoot)**/*.zip" />
      <HelixWorkItem Include="$(AnyOSTestArchivesRoot)**/*.zip" />
      <!-- Only include Unix folders if supported by the target OS -->
      <HelixWorkItem Condition="'$(TargetsUnix)' == 'true'" Include="$(UnixTestArchivesRoot)**/*.zip" />
    </ItemGroup>
    <Message Text="Full test archive collection : @(HelixWorkItem)" Importance="Low" />

    <!-- Verify the test archives exist.  
         NOTE: It may be better to make this an error, but in the past we chose not to as this causes a build break when triggered, versus just no tests run. -->
    <Warning Condition="'@(HelixWorkItem->Count())' == '0'" Text="Didn't find any test archives in supplied folders!!! Review logs to see where test archive(s) were placed and fix." />

    <ItemGroup>
      <HelixWorkItem>
        <Command Condition="'$(TargetsWindows)' == 'true'">RunTests.cmd %HELIX_CORRELATION_PAYLOAD%</Command>
        <Command Condition="'$(TargetsWindows)' != 'true'">RunTests.sh $HELIX_CORRELATION_PAYLOAD</Command>
        <PayloadFile>%(Identity)</PayloadFile>
        <WorkItemId>%(Filename)</WorkItemId>
        <TimeoutInSeconds>$(TimeoutInSeconds)</TimeoutInSeconds>
        <RelativeBlobPath>$(Platform)-$(ConfigurationGroup)/Tests/$([System.String]::Copy('%(RecursiveDir)').Replace('\', '/'))%(Filename)%(Extension)</RelativeBlobPath>
      </HelixWorkItem>
    </ItemGroup>
  </Target>

  <!-- Zips up the runtime directory;  unzip location of this file will be used as the first argument to RunTests.cmd/sh. -->
  <Target Name="CompressRuntimeDir" Condition="'$(SkipArchive)' != 'true'">
    <ZipFileCreateFromDirectory
        SourceDirectory="$(TestHostRootPath)"
        DestinationArchive="$(TestRuntimeArchiveFile)"
        OverwriteDestination="true" />
    <ItemGroup>
      <HelixCorrelationPayloadFile Include="$(TestRuntimeArchiveFile)">
        <RelativeBlobPath>$(Platform)$(ConfigurationGroup)/$(TestRuntimeArchiveFilename)</RelativeBlobPath>
      </HelixCorrelationPayloadFile>
    </ItemGroup>
  </Target>

  <!-- Import this at the end so that it can compose properties as needed -->
  <Import Project="$(ToolsDir)CloudTest.Helix.targets" />

  <!-- main Entrypoint -->
  <Target Name="Build">
    <Message Text="CoreFX-specific Helix test upload project, beginning submission to Helix" />
    <Message Condition="'$(EnableCloudTest)' == 'false'" Text="... will skip upload / submission due to property 'EnableCloudTest' being set to 'false'" />
    <Message Condition="'$(SkipSendToHelix)' == 'true'"  Text="... will skip submission due to property 'SkipSendToHelix' being set to 'true'" />
    <CallTarget Condition="'$(EnableCloudTest)' != 'false'" Targets="CoreFXPreCloudBuild;CompressRuntimeDir;HelixCloudBuild" />
    <CallTarget Condition="'$(LocalHelixExecution)' == 'true'" Targets="ExecuteLocally" />

  </Target>

  <!-- Local Execution entrypoint, can be invoked directly -->
  <!-- Sample direct command line:
          msbuild upload-tests.proj /t:ExecuteLocally /p:LocalExecutionTestList=C:\GIT\corefx\bin\tests\Windows_NT.AnyCPU.Release\archive\TestList.json 
                                    /p:LocalExecutionTestFilter=System.IO
  -->
  <Target Name="ExecuteLocally">
    <PropertyGroup>
      <LocalExecutionTestList Condition="'$(LocalExecutionTestList)'==''">$(HelixLogFolder)$(TestListFilename)</LocalExecutionTestList>
      <LocalExecutionCorrelationId Condition="'$(LocalExecutionCorrelationId)'==''"></LocalExecutionCorrelationId>
      <LocalExecutionFolder Condition="'$(LocalExecutionFolder)'==''">HelixLocalExecution</LocalExecutionFolder>
      <LocalExecutionTestFilter Condition="'$(LocalExecutionTestFilter)'==''"></LocalExecutionTestFilter>
    </PropertyGroup>

    <Message Text="Test List: $(LocalExecutionTestList)" />
    <Message Text="Execution Folder: $(LocalExecutionFolder)" />
    <Message Text="Test Filter: $(LocalExecutionTestFilter)" />
    <SimulateHelixExecution JobList="$(LocalExecutionTestList)"
                            WorkItemExecutionFilter="$(LocalExecutionTestFilter)"
                            ExecutionFolder="$(LocalExecutionFolder)"
                            CorrelationId="$(LocalExecutionCorrelationId)">
      <Output TaskParameter="ExecutionLogs" ItemName="LocalExecutionLogs"/>
    </SimulateHelixExecution>
    <Message Text="Execution complete.%0aLogs:%0a" />
    <Message Text="Work Item:%(LocalExecutionLogs.WorkItemFriendlyName)%0a@(LocalExecutionLogs, '%0a')%0a" />
  </Target>

</Project>