blob: 39ee7fe2dfc0ba62676a3510a3d483f29a3a0392 (
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
|
<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="SubmitTestsToHelix">
<!-- This project uses the helix SDK, documented at
https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.Helix/Sdk,
to send test jobs to helix. -->
<Import Project="..\dir.props" />
<PropertyGroup>
<HelixArchitecture>$(BuildArch)</HelixArchitecture>
<HelixConfiguration Condition=" '$(Scenario)' == 'normal' ">$(BuildType)</HelixConfiguration>
<HelixConfiguration Condition=" '$(Scenario)' != 'normal' ">$(BuildType)-$(Scenario)</HelixConfiguration>
<Creator>$(_Creator)</Creator>
<HelixAccessToken>$(_HelixAccessToken)</HelixAccessToken>
<HelixTargetQueues>$(_HelixTargetQueues)</HelixTargetQueues>
<EnableAzurePipelinesReporter>$(_PublishTestResults)</EnableAzurePipelinesReporter>
<EnableAzurePipelinesReporter Condition=" '$(EnableAzurePipelinesReporter)' == '' ">false</EnableAzurePipelinesReporter>
<HelixBuild>$(_HelixBuild)</HelixBuild>
<HelixSource>$(_HelixSource)</HelixSource>
<HelixType>$(_HelixType)</HelixType>
<TimeoutInMinutes>$(_TimeoutInMinutes)</TimeoutInMinutes>
<TimeoutInMinutes Condition=" '$(TimeoutInMinutes)' == '' ">5</TimeoutInMinutes>
<WaitForWorkItemCompletion>true</WaitForWorkItemCompletion>
<CoreRootDirectory>$(TestWorkingDir)\Tests\Core_Root</CoreRootDirectory>
<TestEnvFileExtension Condition=" '$(TargetsWindows)' == 'true' ">.cmd</TestEnvFileExtension>
<TestEnvFileExtension Condition=" '$(TargetsWindows)' != 'true' ">.sh</TestEnvFileExtension>
</PropertyGroup>
<ItemGroup>
<HelixCorrelationPayload Include="$(CoreRootDirectory)" />
<XUnitWrapperDlls Include="$(TestWorkingDir)\**\*.XUnitWrapper.dll" />
<Scenarios Include="$(_Scenarios.Split(','))" />
</ItemGroup>
<Target Name="CreateTestEnvFiles">
<!-- This target will create one __TestEnv file per XUnitWrapper/Scenario combination -->
<ItemGroup>
<_XUnitWrapperDirectoryWithScenario Include="@(XUnitWrapperDlls->'%(RootDir)%(Directory)')">
<Scenario>%(Scenarios.Identity)</Scenario>
</_XUnitWrapperDirectoryWithScenario>
<_TestEnvProjectsToBuild Include=".\testenvironment.proj">
<Properties>Scenario=%(_XUnitWrapperDirectoryWithScenario.Scenario);TestEnvFileName=%(Identity)\SetStressModes_%(Scenario)$(TestEnvFileExtension);TargetsWindows=$(TargetsWindows)</Properties>
</_TestEnvProjectsToBuild>
</ItemGroup>
<MSBuild Projects="@(_TestEnvProjectsToBuild)" Targets="CreateTestEnvFile" BuildInParallel="false" StopOnFirstFailure="true" UnloadProjectsOnCompletion="true" />
</Target>
<Target Name="SubmitTestsToHelix" DependsOnTargets="CreateTestEnvFiles">
<ItemGroup>
<_ProjectsToBuild Include="$(MSBuildProjectFile)">
<Properties>Scenario=%(Scenarios.Identity)</Properties>
</_ProjectsToBuild>
</ItemGroup>
<PropertyGroup>
<_BuildInParallel>false</_BuildInParallel>
<_BuildInParallel Condition=" '@(_ProjectsToBuild->Count())' > '1' ">true</_BuildInParallel>
</PropertyGroup>
<MSBuild Projects="@(_ProjectsToBuild)" Targets="Test" BuildInParallel="$(_BuildInParallel)" StopOnFirstFailure="false" UnloadProjectsOnCompletion="true" />
</Target>
<Target Name="BuildHelixWorkItem" BeforeTargets="Test">
<PropertyGroup>
<EnableXUnitReporter>true</EnableXUnitReporter>
<FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure>
<TestRunNamePrefix Condition=" '$(Scenario)' == 'normal' ">$(BuildOS) $(BuildArch) $(BuildType) @ </TestRunNamePrefix>
<TestRunNamePrefix Condition=" '$(Scenario)' != 'normal' ">$(BuildOS) $(BuildArch) $(BuildType) $(Scenario) @ </TestRunNamePrefix>
<_XUnitRunnerArgs>-parallel collections -nocolor -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing</_XUnitRunnerArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' == 'true' ">
<_CoreRun>%CORE_ROOT%\CoreRun.exe</_CoreRun>
<_XUnitRunnerDll>%CORE_ROOT%\xunit.console.dll</_XUnitRunnerDll>
<_HelixPreCommands>set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD%;set __TestEnv=%HELIX_WORKITEM_PAYLOAD%\SetStressModes_$(Scenario)$(TestEnvFileExtension);type %__TestEnv%</_HelixPreCommands>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' != 'true' ">
<_CoreRun>$CORE_ROOT/corerun</_CoreRun>
<_XUnitRunnerDll>$CORE_ROOT/xunit.console.dll</_XUnitRunnerDll>
<_HelixPreCommands>export CORE_ROOT=$HELIX_CORRELATION_PAYLOAD;export __TestEnv=$HELIX_WORKITEM_PAYLOAD/SetStressModes_$(Scenario)$(TestEnvFileExtension);cat $__TestEnv</_HelixPreCommands>
</PropertyGroup>
<ItemGroup>
<HelixWorkItem Include="@(XUnitWrapperDlls->'%(FileName)'->Replace('.XUnitWrapper', ''))">
<PayloadDirectory>%(RootDir)%(Directory)</PayloadDirectory>
<PreCommands>$(_HelixPreCommands)</PreCommands>
<Command>$(_CoreRun) $(_XUnitRunnerDll) %(FileName)%(Extension) $(_XUnitRunnerArgs)</Command>
<Timeout>$([System.TimeSpan]::FromMinutes($(TimeoutInMinutes)))</Timeout>
</HelixWorkItem>
</ItemGroup>
</Target>
</Project>
|