Skip to content

Commit af74676

Browse files
committed
* Add RunTestsUntilFailure to build.ps1
1 parent 9919b0c commit af74676

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

build.ps1

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
[CmdletBinding(PositionalBinding=$false)]
22
param(
3-
[switch]$RunTests
3+
[switch]$RunTests,
4+
[switch]$RunTestsUntilFailure
45
)
56

67
Write-Host "Run Parameters:" -ForegroundColor Cyan
78
Write-Host "`tPSScriptRoot: $PSScriptRoot"
89
Write-Host "`tRunTests: $RunTests"
10+
Write-Host "`tRunTestsUntilFailure: $RunTestsUntilFailure"
911
Write-Host "`tdotnet --version: $(dotnet --version)"
1012

1113
Write-Host "[INFO] building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
1214
dotnet build "$PSScriptRoot\Build.csproj"
1315
Write-Host "[INFO] done building." -ForegroundColor "Green"
1416

15-
if ($RunTests)
17+
if ($RunTests -or $RunTestsUntilFailure)
1618
{
1719
$tests_dir = Join-Path -Path $PSScriptRoot -ChildPath 'projects' | Join-Path -ChildPath 'Test'
1820
$unit_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Unit' | Join-Path -ChildPath 'Unit.csproj')
1921
$integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Integration' | Join-Path -ChildPath 'Integration.csproj')
2022
$sequential_integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'SequentialIntegration' | Join-Path -ChildPath 'SequentialIntegration.csproj')
2123

22-
foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file)
24+
Do
2325
{
24-
Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta"
25-
dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed"
26-
if ($LASTEXITCODE -ne 0)
26+
foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file)
2727
{
28-
Write-Host "[ERROR] tests errored, exiting" -Foreground "Red"
29-
Exit 1
28+
Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta"
29+
dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed"
30+
if ($LASTEXITCODE -ne 0)
31+
{
32+
Write-Host "[ERROR] tests errored, exiting" -Foreground "Red"
33+
Exit 1
34+
}
35+
else
36+
{
37+
Write-Host "[INFO] tests passed" -ForegroundColor "Green"
38+
}
3039
}
31-
else
32-
{
33-
Write-Host "[INFO] tests passed" -ForegroundColor "Green"
34-
}
35-
}
40+
} While ($RunTestsUntilFailure)
3641
}

0 commit comments

Comments
 (0)