Skip to content

Commit b6d433c

Browse files
Run helix tests locally (#19031)
1 parent d467283 commit b6d433c

File tree

4 files changed

+51
-22
lines changed

4 files changed

+51
-22
lines changed

docs/Helix.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@ For more info about helix see: [SDK](https://github.com/dotnet/arcade/blob/maste
1212
To run Helix tests for one particular test project:
1313

1414
```
15-
cd src/MyCode/test
16-
dotnet msbuild /t:Helix
15+
.\eng\scripts\RunHelix.ps1 -Project path\mytestproject.csproj
1716
```
1817

19-
To run tests for the entire repo, run:
20-
21-
```
22-
.\eng\scripts\TestHelix.ps1
23-
```
24-
25-
This will restore, and then publish all of the test projects including some bootstrapping scripts that will install the correct dotnet runtime/sdk before running the test assemblies on the helix machine, and upload the job to helix.
18+
This will restore, and then publish all the test project including some bootstrapping scripts that will install the correct dotnet runtime/sdk before running the test assembly on the helix machine(s), and upload the job to helix.
2619

2720

2821
## How do I look at the results of a helix run on Azure Pipelines?

eng/helix/content/runtests.cmd

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePo
2323

2424
set HELIX=%helixQueue%
2525

26-
if (%targetFrameworkIdentifier%==.NETFramework) (
27-
xunit.console.exe %target% -xml testResults.xml
28-
exit /b %ERRORLEVEL%
29-
)
30-
3126
%DOTNET_ROOT%\dotnet vstest %target% -lt >discovered.txt
3227
find /c "Exception thrown" discovered.txt
3328
REM "ERRORLEVEL is not %ERRORLEVEL%" https://blogs.msdn.microsoft.com/oldnewthing/20080926-00/?p=20743/
@@ -41,8 +36,8 @@ set exit_code=0
4136

4237
set NONQUARANTINE_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true"
4338
set QUARANTINE_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:%HELIX%=true"
44-
if (%quarantined%==true) (
45-
echo Running all tests.
39+
if %quarantined%==true (
40+
echo Running quarantined tests.
4641
%DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%QUARANTINE_FILTER%
4742
if errorlevel 1 (
4843
echo Failure in flaky test 1>&2

eng/helix/helix.proj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
<!-- Items with the type "HelixProperties" will become arbitrary JSON associated with the job -->
4343
<!-- NOTE: These are global to the whole Job, so don't include project-specific content here. -->
4444
<ItemGroup>
45-
<HelixProperties Include="buildNumber" Value="$(BUILD_BUILDNUMBER)" />
46-
<HelixProperties Include="buildId" Value="$(BUILD_BUILDID)" />
47-
<HelixProperties Include="azdoProject" Value="$(SYSTEM_TEAMPROJECT)" />
48-
<HelixProperties Include="buildDefinition" Value="$(BUILD_DEFINITIONNAME)" />
49-
<HelixProperties Include="commitSha" Value="$(BUILD_SOURCEVERSION)" />
50-
<HelixProperties Include="branch" Value="$(BUILD_SOURCEBRANCH)" />
45+
<HelixProperties Include="buildNumber" Value="$(BUILD_BUILDNUMBER)" Condition="'$(BUILD_BUILDNUMBER)' != ''" />
46+
<HelixProperties Include="buildId" Value="$(BUILD_BUILDID)" Condition="'$(BUILD_BUILDID)' != ''" />
47+
<HelixProperties Include="azdoProject" Value="$(SYSTEM_TEAMPROJECT)" Condition="'$(SYSTEM_TEAMPROJECT)' != ''" />
48+
<HelixProperties Include="buildDefinition" Value="$(BUILD_DEFINITIONNAME)" Condition="'$(BUILD_DEFINITIONNAME)' != ''" />
49+
<HelixProperties Include="commitSha" Value="$(BUILD_SOURCEVERSION)" Condition="'$(BUILD_SOURCEVERSION)' != ''" />
50+
<HelixProperties Include="branch" Value="$(BUILD_SOURCEBRANCH)" Condition="'$(BUILD_SOURCEBRANCH)' != ''" />
5151
<HelixProperties Condition="'$(RunQuarantinedTests)' == 'true'" Include="runType" Value="quarantined" />
5252
<HelixProperties Condition="'$(RunQuarantinedTests)' != 'true'" Include="runType" Value="unquarantined" />
5353
</ItemGroup>

eng/scripts/RunHelix.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<#
2+
.SYNOPSIS
3+
Runs the specified test project on a Helix machine.
4+
.DESCRIPTION
5+
This script runs the Helix msbuild task on the given project and publishes then uploads the output and runs tests on the Helix machine(s) passed in.
6+
.PARAMETER Project
7+
The test project to publish and send to Helix.
8+
.PARAMETER HelixQueues
9+
Set the Helix queues to use, the list is ';' separated.
10+
Some supported queues:
11+
Ubuntu.1604.Amd64.Open
12+
Ubuntu.1804.Amd64.Open
13+
Windows.10.Amd64.Open
14+
Windows.81.Amd64.Open
15+
Windows.7.Amd64.Open
16+
OSX.1014.Amd64.Open
17+
Centos.7.Amd64.Open
18+
Debian.8.Amd64.Open
19+
Debian.9.Amd64.Open
20+
Redhat.7.Amd64.Open
21+
.PARAMETER RunQuarantinedTests
22+
By default quarantined tests are not run. Set this to $true to run only the quarantined tests.
23+
#>
24+
param(
25+
[Parameter(Mandatory=$true)]
26+
[string]$Project,
27+
[string]$HelixQueues = "Windows.10.Amd64.Open",
28+
[bool]$RunQuarantinedTests = $false
29+
)
30+
$ErrorActionPreference = 'Stop'
31+
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
32+
33+
Set-StrictMode -Version 1
34+
35+
$env:BUILD_REASON="PullRequest"
36+
$env:BUILD_SOURCEBRANCH="local"
37+
$env:BUILD_REPOSITORY_NAME="aspnetcore"
38+
$env:SYSTEM_TEAMPROJECT="aspnetcore"
39+
40+
$HelixQueues = $HelixQueues -replace ";", "%3B"
41+
dotnet msbuild $Project /t:Helix /p:IsRequiredCheck=true /p:IsHelixDaily=true /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests

0 commit comments

Comments
 (0)